Skip to main content
Filter by
Sorted by
Tagged with
Best practices
1 vote
0 replies
26 views

I am working on a multifunctional quite old game bot with the followng implementation: There are tons of mixins in different files/folders (each inherits GameBase). Each mixin: - uses attributes + ...
Vova's user avatar
  • 609
-1 votes
1 answer
141 views

I tried to understand multiple inheritance behaviour with Python, so I tried something but I have no idea why the output of my code is what it is. (I know that diamond inheritance is bad, but was ...
SinisterMJ's user avatar
  • 3,519
1 vote
2 answers
199 views

There are lots of posts on the internet about virtual inheritance in C++. Typically these posts say something like this: Virtual inheritance solves the Diamond Inheritance Problem Virtual inheritance ...
user2138149's user avatar
  • 18.6k
-1 votes
2 answers
111 views

This question is NOT about inheriting two classes. This question is about inheriting ONE of two classes. One OR the other. I have an external unchangeable DLL that provides me with two abstract ...
Daniel Möller's user avatar
0 votes
1 answer
153 views

I'm writing a Python application using tkinter GUI. I created the TimestampWindow class which should be one of my Windows and made it extend the Toplevel class of tkinter's library and Window, a ...
ela's user avatar
  • 401
3 votes
2 answers
101 views

Consider the following code: template<typename T> struct Ambiguous_C { void func(T); }; struct Ambiguous_F { template<typename T> void func(T); }; struct Conflicted_F : ...
Rddvldny's user avatar
0 votes
1 answer
85 views

Problem Let's say I have a hierarchy of classes where each class has an associated list of class-specific items, e.g. class Thing: Items = ['Exist'] class Being(Thing): Items = ['Live', 'Die']...
Alex Sotka's user avatar
1 vote
1 answer
79 views

Given the following Python code: import ctypes from collections.abc import Mapping class StructureMeta(type(ctypes.Structure), type(Mapping)): pass class Structure(ctypes.Structure, Mapping, ...
Markus's user avatar
  • 3,397
-1 votes
1 answer
66 views

I'm working on some Python code that seems like it'll be a good fit for multiple inheritance, and I'm reading about multiple inheritance and super() to make sure I correctly understand how they work. ...
Lux's user avatar
  • 353
0 votes
0 answers
71 views

I wish to call an overridden base class function from 2 or 3 levels down. For example public class Level1 { public virtual void Encrypt(byte[] plain) { Console.WriteLine("level1&...
cup's user avatar
  • 8,538
1 vote
1 answer
65 views

I want to call update for each derived object without a loop, this is the code that produces the loop from method "update()". How to solve it the right way? #include <iostream> class ...
extreme001's user avatar
0 votes
1 answer
72 views

I created a BaseController to control access to methods of all child controllers, and it is in the following code: public class BaseController : Controller { protected readonly ...
Yousif Al-Zoubi's user avatar
2 votes
3 answers
585 views

I'm learning TypeScript about extending the interface. I unintentionally recognized that TypeScript allows extending interface from multiple classes. That made me surprised and I have researched a lot ...
LeoPkm2-1's user avatar
  • 199
3 votes
1 answer
358 views

I am building an app in PySide6 that will involve dynamic loading of plugins. To facilitate this, I am using ABCMeta to define a custom metaclass for the plugin interface, and I would like this custom ...
KBriggs's user avatar
  • 1,488
0 votes
2 answers
103 views

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 ...
user avatar
2 votes
1 answer
107 views

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
135 views

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
1 answer
40 views

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
2 votes
1 answer
131 views

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 ...
user avatar
0 votes
1 answer
42 views

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
1 vote
0 answers
73 views

Code snippet: from PyQt5.QtWidgets import QApplication from PyQt5.QtCore import QObject import sys class ParentA: def __init__(self, x, y): self.b = x + y class Child(QObject, ParentA): ...
hamo's user avatar
  • 25
0 votes
2 answers
89 views

I have this class hierarchy in C++: class ISegmentReader { public: virtual void readCacheFromDb() = 0; //... }; class ISegmentManager: public ISegmentReader { //readCacheFromDb not ...
user129186's user avatar
  • 1,268
2 votes
1 answer
94 views

I have a child class named USA and it has two parent classes, A and B. Both parents have a method named change_to_4 and in B.__init__ I call the method, but instead of using the method that I defined ...
Ali Rashidi's user avatar
0 votes
0 answers
63 views

Imagine I have a big list of typedefs that I don't want to repeat for all classes, and I create a base class: template<class Derived> class TypesDefs { using ptr = std::shared_ptr<Derived&...
SpeakX's user avatar
  • 427
0 votes
0 answers
117 views

I have this model structure: class Main (models.Model): name=models.Charfield(max_length=50) ... class Category (Main): type=models.Charfield(max_length=50) ... class SubCategory1(...
javistro's user avatar

1
2 3 4 5
56