user1529641
user1529641

Reputation: 67

how to customise the specific subclasses which are extending the common abstract class

I have an base abstract class containing common methods to which there are subclasses which are extending that abstract class in its own specific way.

Now please advise is there any other way in object oriented methodology in which say lets say if i wanted to implement any specific functionality for all subclasses but i do not want to declare it in abstract class also , can i implement that specif functionality in subclass itself but I am confused will it be a god design ie there any specif pattern in which i can modify all the subclass without disturbing the parent class

Upvotes: 1

Views: 50

Answers (1)

Mukesh mohan
Mukesh mohan

Reputation: 101

IF you want to implement any specific functionality for all subclasses, Then it is good to have it in the abstract class itself otherwise it leads to code duplication.

Is there any specific reason you don't want to implement the method in abstract class.

Upvotes: 1

Related Questions