Skip to main content

Questions tagged [multiple-inheritance]

A feature of some object-oriented computer programming languages in which a class can inherit behaviors and features from more than one superclass or base class.

multiple-inheritance
1 vote
2 answers
19 views

Does multiple data processing violate the principle of interface separation?

I have the code. @startuml interface DbReader{ {abstract} read() } interface DbWriter{ {abstract} write(obj) } class DbConcrete { read() write(obj) } DbConcrete .up.|> DbReader DbConcrete .up.|...
Alexander Rakhmaev's user avatar
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 ...
Elerium115's user avatar
-1 votes
2 answers
85 views

The operators for my derived class do not work as intended

I made this code that has 4 classes. The SpecialCharacter class has 2 bases, Hero and Enemy, both of which have Person as their base class. #include <iostream> class Person { private: char* ...
Digits's user avatar
  • 23
2 votes
1 answer
84 views

Override function with variadic template inheritance

I have a class that inherits from 2 sets of base classes, according to variadic template arguments. One of those sets defines a virtual function. I want to do something like this but I'm not sure how ...
Leonardo Faria's user avatar
1 vote
1 answer
96 views

Python Multiple Inheritance generates "TypeError: got multiple values for keyword argument"

I'm running into a problem using multiple inheritance in Python. In my code, Child class A inherits from two Parent classes, B and C, both abstract base classes. Each of the Parent classes, B and C, ...
Overtoad's user avatar
1 vote
1 answer
44 views

How should I write Google-Truth Subjects for an object heirarchy that uses interfaces for multiple-inheritance?

The situation I'm writing tests for a personal project (in Java17 using JUnit5/Jupiter and Google Truth ) where I use the multiple-inheritance of interfaces to define classes. For example: Example ...
GeenDutchman's user avatar
0 votes
0 answers
78 views

How to properly inherit from multiple interfaces which declare signals and slots in Qt 6

I want to have two different interface classes that declare signals and pure virtual slots, and have a implementation class that implements both of them and thus inherits their individual signals and ...
Punitto Moe's user avatar
0 votes
1 answer
30 views

How can I create an adapter that can adapt between two different data machine classes

A class that stores and handles access to some machine of type A: class DataMachineA: def __init__(self): # some dummy data self.data = {"type": ["A", "A&...
amalelwatta's user avatar
1 vote
2 answers
71 views

C++ multiple inheritance- class method running twice

I have an exercise to practice multiple inheritance and polymorphism and something is not going well. The exercise includes 4 classes I need to build: Creature char * name int age int ...
Reef Kenig's user avatar
4 votes
1 answer
100 views

Why is there a difference between an operator and the corresponding member function?

Why is there a difference between the operator call and the corresponding member function call with Clang 17.0.1? Shouldn't they behave the same way? #include <iostream> struct A { void ...
jabaa's user avatar
  • 6,346
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 ...
CreeperCrafter979's user avatar
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. ...
Michael's user avatar
0 votes
1 answer
37 views

Multiple inheritance: how to correctly override a method? The complementary of the complementary of an object

TL; DR I'm trying to implement the complementary of the complementary of a spatial region The current solution works with a huge side effect The solution is based on multiple inheritance. Which doesn'...
tiago.seq's user avatar
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 ...
pranish's user avatar
  • 11
5 votes
1 answer
217 views

Is it legal to zero empty C++ classes in the constructor and inherit from them?

It is not very rare to find a library that zeros its objects in the constructors using memset. And sometimes it happens to empty classes as well. Is it safe, especially when one inherits such classes? ...
Fedor's user avatar
  • 19.2k

15 30 50 per page
1
2 3 4 5
183