Skip to main content
Filter by
Sorted by
Tagged with
4 votes
1 answer
2k views

I have classes A, B, and C. C inherits both from A and B, and for the most part wherever there are methods overriding each other I want A's to override B's, so I have the following structure: class A: ...
KSS's user avatar
  • 179
0 votes
2 answers
1k views

Summary: The case below involves using multiple inheritance for inheriting both an extended interface, and implementation for a basic interface. I used virtual multiple inheritance to put in place the ...
wohlstad's user avatar
  • 35.8k
1 vote
1 answer
71 views

#include<iostream> using namespace std; class String { protected: enum {SZ= 80}; char str[SZ]; public: String (){str[0]='\0';} String(char s[]) { ...
Waqar Ahmed's user avatar
2 votes
1 answer
217 views

I've been working on a client/server TCP application of which here's a rough outline: config_type = namedtuple('config', ['host', 'port']) class Server: def __init__(self, config: config_type): ...
Ian Newson's user avatar
  • 7,957
0 votes
1 answer
494 views

I am learning multiple inheritance in Python. I have two parent classes Robot and Human. They are being inherited by Cyborg class. I can access the member variable in first class i.e, Robot but unable ...
NaveedAli92's user avatar
-2 votes
1 answer
131 views

I have a question about multiple class inheritance in python. I think that I have already implemented it correctly, however it is somehow not in line with my usual understanding of inheritance (the ...
user101893's user avatar
0 votes
1 answer
33 views

I'm unsure the best way to do the following. That is, I'm not sure if I should have a parent class UniSamplingStrategy and child classes UniformSampling, and RandomSampling. Or should I just have ...
Scott Riggs's user avatar
0 votes
1 answer
155 views

I ended up in a situation lined out below. I have one library that is pure CPP without external libraries, and another project that is an SDK to interface with an external library. "I" in ...
Amber Elferink's user avatar
0 votes
1 answer
66 views

I am learning about java inheritance and i am a bit confused, if i write a program that handles 3 files: 1) cheese.txt 2) fruits.txt 3) drinks.txt If i have a parent class called Food ...
programme3219873's user avatar
1 vote
0 answers
143 views

I'm doing a project on multilevel inheritance with a deck of playing cards. While working on the project, i received a compilation error in my program that was specifically for the suit classes (...
GeneralIT's user avatar
0 votes
0 answers
35 views

I am working on a class that has two parent classes: GetSetInterface which derives QObject and QSpinBox(which derives QObject aswell) And I Call it SpinBoxInterface class GetSetInterface : public ...
Lidbey's user avatar
  • 371
2 votes
2 answers
1k views

from typing import Generic, TypeVar, Any R = TypeVar('R') X = TypeVar('X') class SizedIterator(Generic[X]): def __init__(self) -> None: pass class TfmIterator(Generic[R], ...
Bleyddyn's user avatar
  • 387
3 votes
1 answer
2k views

This has probably been asked to death, but I really think this question will help someone because I really can't find a question or answer for this. I have made an effort to boil the code down to its ...
James Potter's user avatar
0 votes
0 answers
31 views

I'm not quite sure how should it be written correctly. Can anyone help please? class A { public: A(int x); }; class B { public: B(float y); }; class Launcher : public A, public B { ...
Den's user avatar
  • 29
3 votes
2 answers
2k views

Consider the following code: from typing import Union class A: def function_in_a(self) -> str: return 'a' class B: def function_in_b(self) -> str: return "b" class C(A, ...
user32882's user avatar
  • 6,107
1 vote
1 answer
141 views

let's say I have this class class child(parent1, parent2): pass Would it be possible to access parent2.__init__, if parent1 also has a defined __init__ ?. Here is my complete code. class parent1: ...
Aldhair Garza's user avatar
0 votes
1 answer
64 views

I have one class that should extend two classes I'm not sure anymore if this is possible and how. would it be possible that for example my shopModell class extends from the logins and safeinput class?
anyone's user avatar
  • 39
-2 votes
2 answers
174 views

Lets say we have different kind of people, pianist,programmer and multitalented person. so, How do i inherit like this? currently this code gives error Multitalented has no attribute canplaypiano. ...
Vigneswar A's user avatar
1 vote
1 answer
53 views

I followed this example to create a build pattern with inheritance, but in the child classes I have common fields that I would like to have in a separate class. BaseConfiguration ...
Alberto's user avatar
  • 795
5 votes
3 answers
1k views

Please consider the following program: using System; public interface IFoo { void DoFoo(); } public class Bar: IFoo { public void DoFoo() => Console.WriteLine("BAR!"); } public ...
aparpara's user avatar
  • 2,201
0 votes
1 answer
417 views

I'm reviewing OpenZeppelin's smart contracts and in many cases I find that there tends to be a redundant or duplicate inheritance. contract ERC20 is IERC20, IERC20Metadata {} interface IERC20 {} ...
fcurdi's user avatar
  • 1
0 votes
1 answer
49 views

If you have one class using multiple inheritance using two classes with the same name for a function, which function takes priority? From what I found the function coming first in the class ...
Ian's user avatar
  • 3
0 votes
0 answers
51 views

I am trying to use interface IComparable (not in this mockup code) and its 2 implementations to work on same object. I must use operators to do so. I would like to do it without resolving like here c....
Rengar's user avatar
  • 1
0 votes
0 answers
436 views

I'm using mixins to add optional functionality to a simple base class, like so: template<int N> struct IntDelay { void setDelay(const float (&newDelays)[N]) { for (uint i = 0; i &...
kippertoffee's user avatar
0 votes
1 answer
613 views

I'm attempting to derive a class C from two classes, A and B; after reading this answer, I attempted to write using B::<function> in order to override a pure virtual function in A with the ...
wintergreen_plaza's user avatar

1
3 4
5
6 7
56