Original Post
🔒 Locked
Virtual methods
Advertisement
and you would put this code inside another override in class C.
C::func()
{
A::func();
}
of course this is a fairly good sign that something in your design is not quite right, because the idea of C deriving from B indicates C is more like B than A. Of course this is not always true. And definately not true if you are doing something else in addition to A::func() in C. But how does class C know it doesn't want what is in B's version ... and how will you know 6 months from now when you change B?
C::func()
{
A::func();
}
of course this is a fairly good sign that something in your design is not quite right, because the idea of C deriving from B indicates C is more like B than A. Of course this is not always true. And definately not true if you are doing something else in addition to A::func() in C. But how does class C know it doesn't want what is in B's version ... and how will you know 6 months from now when you change B?
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement