Hi I have another question concerning style
I have a (parent) class with several virtual methods
class parent
{
virtual void A() {}
virtual void B() {}
virtual void C() {}
}
Then I have several child-classes
class child1 : public parent
class child2 : public parent
class child3 : public parent
When I do not need some of the methods ( like B and C in Child 2/Child3):
1. Would I write them in the .h/.cpp without filling the body of the method (like in Child 3)
2. or would I leave them out like in class child 2
class child1 : public parent
{
virtual void A() {qDebug()<< "I am A of child 1" ; }
virtual void B() {qDebug()<< "I am B of child 1" ;}
virtual void C() {qDebug()<< "I am C of child 1" ;}
}
class child2 : public parent
{
virtual void A() {qDebug()<< "I am A of child 2" ; }
}
class child3 : public parent
{
virtual void A() {qDebug()<< "I am A of child 3" ; }
virtual void B() {}
virtual void C() {}
}
Thank you
I know that you do not have to but is it good style to do so or would one leave them out for style-reasons.