42,887 questions
Best practices
0
votes
6
replies
132
views
How can I override a property in a way that gives me static access to the property?
I'm developing a winforms application with an underlying database. My system has a BusinessFunction which describes the business functions a user with a given role is able to perform, and the ...
10
votes
1
answer
549
views
Why does a class inherited from lambda type lack conversion to function pointer in Visual C++?
If a lambda is capture-less, its closure type has conversion operator to function pointer. For example,
auto l = []{};
using F = decltype(+l); //pointer to function type
constexpr F p = l;
And if a ...
Best practices
0
votes
3
replies
47
views
In a VB.Net WPF XAML Project I want to Add a Property to a Usercontrol class and Inherit from that Class
In a VB.Net WPF XAML project, I want to add a Property to a UserControl class and inherit from that Class.
I have tried the following:
Public Class clsUcBase
Inherits UserControl
Private ...
3
votes
1
answer
155
views
How to access elements of a derived container class
I am having trouble understanding/fixing a problem I am encountering in my first attempt to create a derived container from an abstract superclass.
It seems that I cannot access the derived class's ...
2
votes
1
answer
107
views
Generic interface with default implementations
I have this interface:
public interface IDebugEndPoint
{
void InstructionReady(ICPU cpu);
}
where ICPU is implemented by many concrete CPU types. I pass an IDebugEndPoint to an ICPU for "...
0
votes
2
answers
55
views
Correct way of Odoo model and view inheritance (delegation)
I have a custom module which defines a model which inherits res.partner (delegation) using inherits on partner_id field, like this:
from odoo import fields, models
class CustomModel(models.Model):
...
3
votes
1
answer
87
views
Reducing casting and delegation boilerplate when using derived classes with generic params [closed]
Suppose I have a bunch of generic Herbivore types, each coupled with a specific Vegetable type which it knows to consume. Further suppose I want to be able to dump any generic vegetable onto any ...
1
vote
2
answers
68
views
Exception when loading F# types that implement an interface which uses generics from an assembly
I'm trying to load a type from an assembly at runtime that implements this interface which is in a project called PluginBase:
type IPlugin =
abstract member TestString: Option<string> with ...
Advice
2
votes
3
replies
85
views
Is there a way for python to notify that you are overriding non existant method?
In java we have abstract classes and interfaces where we declare set of methods that will exist on objects that conform when interacting with implementations of that type
abstract class Foo {
...
0
votes
1
answer
72
views
How does super() initialize properties on a subclass instance in JavaScript?
I’m learning Object-Oriented Programming in JavaScript and got confused by the following code:
class Animal {
constructor(lg) {
this.legs = lg;
}
}
class Dog extends Animal {
constructor() {...
1
vote
2
answers
157
views
Hierarchy of SQL domains without duplicated parent domain definitions [closed]
How could I code a hierarchy of SQL DOMAINs without duplicating the code for the root SQL domain (thus implementing inheritance)?
E.g., here is a hierarchy of SQL domains:
text
advise
comment
name
...
Best practices
0
votes
3
replies
72
views
Python Inheritance Class Argument NameError
I’ve searched the space of Python nested class inheritance and have read that it's not best practice. I have a NameError on the following:
class A()
pass
class B(A)
pass
I indeed ...
1
vote
2
answers
162
views
How can I use two pointers to an interface to invoke the correct function that takes implementing classes as arguments?
I would like to know the proper way to get the following code to work.
With inheritance, you can call the function of a parent pointer and execute the child function. But, if there are two parent ...
Advice
1
vote
3
replies
155
views
Is there a way to inherit nested types?
We're using an attribute, which looks somewhat like this (simplified):
unit SomeProject.ThreadLibrary.Attributes;
interface
type
ThreadAffinityAttribute = class (TCustomAttribute)
...
0
votes
1
answer
89
views
SwiftData iOS 26: Model inheritance breaks when another model has relationships to the parent class
I'm testing SwiftData model inheritance (new in iOS 26) and encountering a crash when combining:
A model that inherits from another model
A separate model with relationships to the parent class
...