I am happy to see this topic. I am in the middle of changing my essentially C source code to a truely object oriented one. I have used simple inheritance but flouted the IS-A rule to save some typing effort for now. The offending classes look as below.AlvaroBegue wrote: Personal opinion: If you want to live a happy life, don't use virtual inheritance, multiple inheritance or non-public inheritance. Use simple, non-virtual, public inheritance, and only to get polymorphic behavior, and only when inheritance expresses an "IS-A" relationship.
class A
{ calculate lv's };
class B : public A
{ code };
class C : public B
{ code };
The engine now works with ~25% drop in nps at early mid-game. Web search did not yield a definite answer to whether inheritance or OOP per se can cause this much drop. I intend to go ahead with changes and reduce one level of inheritance by using composition thus:
class A
{ calculate lv's };
const A lv; //access lv members as needed
Can this improve nps?