Questions tagged [multiple-inheritance]
The multiple-inheritance tag has no summary.
53 questions
2
votes
1
answer
141
views
Decorate class which inherits from concrete class(es)
In my project I have several "basic" interfaces whose behavior is fixed, i.e. the default implementation will always be good for every puropse. So I defined them as concrete classes with ...
18
votes
8
answers
14k
views
Why is "diamond problem" a problem? Why doesn't the child simply call both parent's methods sequentially? Why is a thing with solutions a problem?
I know there have been many post about diamond problem, one of it: Why do you reduce multiple inheritance to the diamond problem?. But I'm not asking what it is or what is the solution of the problem. ...
0
votes
0
answers
588
views
What is the Best Practice for handling multiple Entities that behave identically?
Because I have multiple entities with unique fields, I need multiple repositories for each one even though each Entity will be handled exactly the same. What is the best way to handle these separate ...
-1
votes
1
answer
853
views
What is the use of Multiple Inheritance in languages like C++ and Python?
C++ and Python are the only two languages I know supporting multiple Inheritance. Other object oriented languages I have seen like Java and Ruby do not support multiple inheritance. Even the front-end ...
0
votes
1
answer
67
views
Select inheritance hierachy at run time
I want to model a machine with a class machine. By the way the architecture of the project has been built, the module that defines each machine is its own directory.
So in directory manufacturer/...
0
votes
1
answer
86
views
"Subtractive" behaviour extension vs overriding a function completely - what are the pros/cons?
Lets imagine some vendor code that we want to extend on our project level
protected function getDefaultFormClasses() {
return [
new FormClassA(),
new FormClassB(),
new ...
2
votes
1
answer
317
views
Selective method inheritance
I have a lot of classes that are just a CRUD interface for microservices. They only have a param for the endpoint and some of the methods get_list / get_item / create / update / delete / activate / ...
6
votes
3
answers
9k
views
Interfaces in Python, multiple inheritance vs. a home-made solution
I am writing a Python framework. In order to ensure a class has some properties, I make base "interface" classes like:
class BananaContainer:
def __init__(self):
self._bananas = []
@...
2
votes
1
answer
264
views
Using virtual inheritance for an interface system based on abstract classes
I want to use a physics engine (like bullet or PhysX) in my program, however I want to hide the actual physics engine from it, so I can easily swap it out with another during run-time (e.g. switch ...
2
votes
1
answer
368
views
Approach for implementing Device and Protocol layers in C++?
I'm writing a program that will interface with an external device. It will support numerous devices that may use different communication interfaces like USB, serial, etc.
This is what I have so far:
...
2
votes
4
answers
5k
views
Avoiding vtable pointers in objects in C++
In my previous question, it was highlight that implementations of C++ such as GCC must store a vtable pointer in every copy of a class for each parent class which has a virtual function.
So a class ...
18
votes
2
answers
18k
views
Should a trait refer to parent methods?
Is it a code smell if the methods in my trait refer to parent::methods or to methods that are assumed to be in the utilising class?
A random (senseless) example
trait foo
{
public function bar()
...
0
votes
3
answers
157
views
Separated implementations or one with all functionalities
I am currently creating Excel import modules for some complex data. I didn't plan it well and I have met code reuse issues. I have made first modules and I realized that next modules will need some ...
1
vote
1
answer
115
views
Client to application interaction results in fat interfaces
How do you handle fat interfaces? Here is an example:
public class TSP
{
public AddEmployeeContribution(...) {...}
public AddMatchingContribution(...) {...}
public CalculateTotal() {...}
...
-1
votes
1
answer
157
views
What would be the best option in this scenario?
I have a statement. I know the ups and downs of both Composition and Inheritance, but I am unable to realize that what would be the best option the given scenario.
SCENARIO:
A Software company is ...