jeudi 22 février 2018

Inheriting an implementation class for a method reusability

There is an implementation class - Class P, which has around 10 concrete methods in it. My interest lies with one of the methods of this class.

Problem is my class is not encouraged to directly call Class P method. Also for my class to access Class P method i will need to add a condition in the desired Class P method.

My question is which is more subtle-

  • inherit Class P into a new impl class and use this (given the no of methods in this class P i am not sure if this is right, as i will have overhead of unwanted extra methods).

  • or adjust my operation in the Class P method by adding few lines in Class P method.

Aucun commentaire:

Enregistrer un commentaire