All Questions
Tagged with inheritance multiple-inheritance
855
questions
0
votes
2
answers
62
views
multiple inheritance without defining a class [duplicate]
I'm not sure that's possible, and I'm wondering if that's the way to go, or if there exists a better way of doing that.
I'll create a toy example to expose what I'm looking for.
Suppose I have people ...
3
votes
2
answers
74
views
C++ Runtime polymorphism calling unexpected override when multiple classes are inherited
I am trying to create a GUI system with C++11 where, perhaps like Godot, every "node" has a very specific purpose such as grouping other nodes, drawing a rectangle, or detecting when a ...
0
votes
0
answers
30
views
Java Swing problems with invoking paintComponent() in Sub-Subclass?
I want to paint node structures with Java Swing.
There's a class
NodeView extends JPanel
and three subclasses representing individual tree structures.
These subclasses are extending NodeView (e.g. ...
0
votes
0
answers
18
views
Python super().__init__() doesn't call multiple inherited classes? [duplicate]
In my example i have two classes FirstClass SecondClass
class FirstClass():
def __init__(self) -> None:
print("First class instance creation")
pass
class ...
0
votes
2
answers
86
views
mutiple inheritance: use __init__ method of two superclasses
I want to make multiple inheritance, making a subclass inherit from two different super classes. This subclass should have an __init__ method in which the __init__ methods of the super classes are ...
0
votes
1
answer
120
views
Multiple inheritance going from one Base Class to another [duplicate]
Assunme I have some abstract class A. I want to cast into some other class B only if the dynamic type of A is a class that also inherits from B. Is there a good way to do this that doesn't involve ...
0
votes
0
answers
47
views
Unable to use super() with multiple inheritance in Python [duplicate]
as part of a practice of our Python knowledge, we are required to create a child class that inherits from A,B,C, to produce the output "The Name is Elzero". While I managed to do it using ...
0
votes
0
answers
19
views
How to deal with class __init__ method that generate from type() function? [duplicate]
I write a class C generate from type, it can use; but when I write another class D inherit from C, an
error that miss required positional argument occurred. so, I tried to use normal inherit way to ...
2
votes
1
answer
55
views
Can a merge relation in a UML-Package Diagram lead to multiple inheritance?
I wonder whether the use of the merge-relation in an UML package diagram might lead to multiple inheritance.
Specifically, I was thinking about the following situation:
A package containing a class ...
0
votes
1
answer
120
views
python - "Extending" multiple classes with inheritance/decorators that works with code completion
I have multiple classes, let's say OrigClass1 to OrigClass100 from an external package.
I want to "extend" them, that is add the same set of attributes and methods to each one of them.
I ...
0
votes
0
answers
30
views
Confusing super keyword in multiple inheritance [duplicate]
I have two code blocks, which I believe is the same, but they result in different output.
Code block 1
class GP:
def __init__(self):
print("GP")
class P1(GP):
def __init__(...
2
votes
0
answers
69
views
The correct mental model for diamond inheritance in C++
I am trying to understand how the sizes of derived objects are constructed, especially in the case of diamond inheritance, and how virtual inheritance works.
Example of a diamond inheritance:
class A {...
-1
votes
1
answer
77
views
change the variables in the __init__ method of inherited classes
I am trying to change default value of "seed" which is inside __init__ method after I built an instance of a class which inherited from other classes. I have "Environment" class ...
1
vote
0
answers
52
views
Python multiple inheritance accessing all inherited attributes
I am trying to wrap my head around multiple inheritance and contrived a very simple example that is not able to access all of the inherited attributes. This may or may not be possible, but if so I ...
1
vote
2
answers
114
views
super() in inherited class that will be inherited with multiple inheritance
If one has a class that inherits, and uses super() to refer to the parent class, and then inherits from that class using multiple inheritance, super() gets confused and no longer looks at the current ...