I have a few classes which’s structure looks like this–
class App
{
// Basic structure of the app
}
class Win32Window
{
// Window functionality
}
class Win32Input
{
// Input functionality
}
class Graphics
{
// Graphics functionality
}
All of those are singleton classes as i plan to have no more than one instance of those in my program.
Now suppose if another class inherits those like this —
class SomeClass final: public App, public Win32Window, public Graphics, public Win32Input
{
// Overrides some virtual methods of base classes or use their implementation
}
Now, is this kind of inheritance bad? To my knowledge it won’t have the Diamond problem that multiple inheritance typically has.
I am not having any problem using this way of inheritance but i want to know if it’s bad practice
New contributor
Ahmed Srabon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.