42,896 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
2
votes
2
answers
132
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
2
replies
55
views
Python Inheritance Class Argument NameError
I’ve searched the space of Python nested class inheritance and have read its not best practice. I’ve a NameError on the following:
class A()
pass
class B(A)
pass
I indeed understand ...
1
vote
2
answers
160
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
145
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
54
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
...
Best practices
0
votes
2
replies
85
views
Difficulties comprehending best way to define classes using S7
I've recently come across the new S7 and its class systems. I have some experience with classes using Python, but never really grasped it quite well.
This is not a pure coding question (I'm not ...
1
vote
1
answer
164
views
How to allow a Generic class to have itself as a type and required property
I have a generic class for a "general" tree node as follows (simplified):
public class GeneralTreeNode<V>
{
public virtual GeneralTreeNode<V>? Parent { get; set; }
public ...
1
vote
1
answer
149
views
Why is my empty optional non-empty when I heap-allocate a single byte?
The following code throws, which indicates that x has a value while it should be empty:
#include <initializer_list>
#include <optional>
#include <print>
#include <stacktrace>
#...
9
votes
1
answer
602
views
Is changing an abstract method to virtual a breaking change?
Let's say I have an abstract class with a public abstract method. If I make that method virtual instead of abstract (i.e. provide a default implementation), is that a breaking change?
I think not ...
0
votes
0
answers
67
views
Casting collection<implementation> to collection<interface> [duplicate]
In Java, having two interfaces:
public interface SomeAbstractResult {}
public interface SomeInterface {
Collection<SomeAbstractResult> someMethod();
SomeAbstractResult someMethod2();
}
...
0
votes
1
answer
89
views
Constructor not accepting list of derived class as argument [duplicate]
I have tried using both base class and interface and in both instances I am told a constructor that takes my arguments does not exist. I have two classes that are related to each other and I want to ...
Best practices
0
votes
6
replies
186
views
dynamic_cast to any one of several options
Somewhat similar to this question, I have something like this:
class DerivedA: public Base
{
void operation(const Base& x, const Base& y) override // pure virtual in Base
{
...
0
votes
0
answers
61
views
Mapstruct and multiple derived classes
I am having trouble wrapping my head around subclass mappings. I have 3 classes:
@Data
public class Parent {
long id;
String name;
public boolean isEmpty() {
return StringUtils.isEmpty(name)...
Advice
0
votes
9
replies
140
views
Why the inherited method output parent's data?
Explain please why the output is "Base" ? Isn't getClassName method inherited?
class Base {
public String className = "Base";
public String getClassName() {
...
3
votes
1
answer
204
views
"The type initializer threw an exception" even though static fields are initialized [duplicate]
I'm getting a TypeInitializationException when running this C# code.
It happens when a constructor tries to add an instance to a static list that should already be initialized.
You can run it here:
...