lundi 24 février 2020

How to make a decision to create a new child class

I have a Parent Class P. The parent class has class member variables. I have a Child class C1. C1 has a final member variable F1. Class C1 is being instantiated from several places.

I have to add a new blank final variable F2 I cannot add that to Class C1 since I do not know the value of F2 from where class C1 is instantiated. Also, I do not the value of the F1 from where I want to pass F2

Should I be creating a new child class for adding F2? How do I make a decision? If Yes: tomorrow, I have a requirement to add a new final variable F3 with similar constraints, should I be making another child class?

Aucun commentaire:

Enregistrer un commentaire