I have class called GeneralLine that recive String (line with several fields and build itself using this string
for example - if the constructor get the following strign argument
then the fields key is set to 1 , field "label is set to "My name" ext..Code:
1 text1 "My name" Itai
However - I want to add special feature
if getting this string
then the line 12 imports the properties of another line with key 1Code:
12 import 1
I want to make it subclass - with differnet properites - for example refernce field for the imported GeneralLine and method that update the subclass accordingly.
The problem is - I dont know which type of class it is- until the string is read within the constructor itself.
What do you advise ?Quote:
GeneralLine g1 = new GeneralLine(string1);
It is not just state or addtional method that I can solve with simple if-else
some of the major method will be sifferent in the subclass
GeneralLine.getName -> return field name
subclass.getName -> return refernceToImport.getname