Skip to main content

All Questions

0 votes
0 answers
16 views

Efficient design solution for handling dynamic marking schemes with multiple levels and subjects

We're developing a grading system for a school with multiple levels (e.g., elementary, middle school, high school) and various subjects within each level (n subjects < 200). The challenge is that: ...
shithanshu mishra's user avatar
1 vote
0 answers
54 views

Implementing a NON-implementation (example from "Head First Design Patterns")?

In "Head First Design Patterns," there is an example involving flying behavior of ducks that gets refactored because there is a combination of flying ducks (eg Mallards) and non-flying ducks ...
Hank's user avatar
  • 63
0 votes
0 answers
51 views

What design pattern would this be, and is it a good idea for run-time selection?

We have a very common calculation Compute that can be done multiple ways. These inherit from some IFoo interface. We'll call them FooRed and FooBlue. class FooRed : public IFoo { public: FooRed() = ...
Root of All Things's user avatar
1 vote
1 answer
31 views

Good structure for cases where only some classes in the inheritance hierarchy need certain fields or functions

I want to know a good structure for cases where only some classes in the inheritance hierarchy need certain fields or functions. I'm creating a program with the following structure: class Singleton { ...
Hree's user avatar
  • 49
0 votes
2 answers
82 views

Singleton Inheritance - Which object is created?

I've created two classes - a base class and derived class where the base class is a singleton. When I call the derived class constructor, which object is being created as the static instance? Is it a ...
Gaurav Mehta's user avatar
0 votes
1 answer
89 views

Class inheritance design with protected methods and run time base handlers

Using C#, I got a class called BaseConfigurations which handles CRUD operations. This class also contains a protected method which is used inside the CRUD handling methods: public class ...
CodeMonkey's user avatar
-1 votes
1 answer
85 views

Java : generics, inheritance and best design

I have a basic processing interface : public interface Processing<T> { void appendTo(T t); } And this inheritance tree : public class Animal { } public class Dog extends Animal { ...
AntonBoarf's user avatar
  • 1,273
0 votes
0 answers
91 views

Architecture of C++ matrix classes: inheritance or specialisation?

I would like to define a class : template <class T, std::size_t M, std::size_t N> class Matrix with simple and classic methods applied to any matrix (std::array<std::array<T, N>, M> ...
Julienchz's user avatar
0 votes
1 answer
121 views

Code for both static and dynamic polymorphism in C++?

Is there a way so that I can write code as the follows: IConnection<Socket> s{Socket{...}}; // statically Connection* c = new Socket{...}; //dynamically // a heterogeneous list that ...
StructSeeker's user avatar
0 votes
0 answers
45 views

Is it good practice to define a inner memeber accessor operator overload for CRTP template?

This occurs to me that I can add template<typename T> class ISock { public: Message Recv() { return static_cast<T*>(this)->Recv(); }; ~ISock(){ ...
StructSeeker's user avatar
-1 votes
2 answers
68 views

How to create a polymorphic behavior when sub-classes have extra fields, compared with base-class?

Let us assume we have the following hierarchy: (It's worth mentioning that the example uses Person-Student case just for the sake of simplicity) class Person { public string Name; public int Age;...
oopEnthusiast's user avatar
2 votes
0 answers
55 views

How can we reduce a multi-functional class with conditional logic into fundamental classes with specific logic - C# ASP.NET Core

In an ASP.NET Core EF application, I have a CentralDesignObject with many types of related data, and a significant amount of derived / calculated values based on the information applied to the ...
freedomdev's user avatar
1 vote
1 answer
82 views

Design pattern for handling different sets of inherited variables?

I have a base class that stores all columns of a record of a database. I want to have three child classes that send different fields of that record to different recepients using the Run() method. But, ...
user avatar
0 votes
2 answers
108 views

How to make use of a fixed hierarchy of classes for various similar entities, like employee-Manager for company 1,2,3

I have a class say Employee and a subclass (of Employee) say Manager. There are various methods (and data member) in Employee class related to payroll, employee details, appraisal, etc. Similarly for ...
user265976's user avatar
1 vote
1 answer
47 views

Dynamic Inheritance, some piece of code... could you look and help me to improve my code?

So I have built this piece of code, but it looks like something is wrong in it. Is it not bad practice to creates function which creates class like below? Should I build some subclasses? base file ...
Paweł Pietraszko's user avatar

15 30 50 per page
1
2 3 4 5
46