Hi all,
I have got the following problem and would appreaciate if someone can help me:
There are several classes that enlarge the former ones by inheritance (e.g. the derived classes have more variables). What I would like to have is one method e.g. "get_relevant_variables()" that returns all variables that might be of interest in the particular class.
This method can be marked as virtual and maybe overwritten afterwards. The Problem is, that the return object has to be different (dependent on the relevant variables in the particular class). I would like to have just one method that receive the particular variables from outside.
I have tried to use Collection
Many thanks in advance
Axel
AxelPosted Feb 20, 2009, 5:57 AM
well, this might work, but I would have to update two seperate streams of classes which will lead to mistakes sooner or later. I have already tried classes within classes but the outer routine cannot see the members.
Is there a way to design an outer class which has just one method "Add_Variables(object Variable)" wherein I put the variables that I want to have and this class copies the added variables by "new object Var1 = typeof(Variable); than Var1 = Variable." But this doesn't work unfortunately.
Albertto LiePosted Feb 20, 2009, 4:25 AM
how bout making a new type/class, that contain all of the variable u need.
like class "retVar" that have properties "retVar1", "retVar2", "retVar3" ,ect
u can set the type of every properties to.
AxelPosted Feb 19, 2009, 5:54 AM
I have already tried to solve my problem with arraylist but the variables names get lost in outer methods/class.
Since the global methods do not know which variables are return by the method getResults() it might be useful to know the meaning of the single variables.
Kaustubh MhadgutPosted Feb 19, 2009, 5:13 AM
Hi Axel,
I think you should go for arraylist. Fill the arraylist with all the required variables, and then return them.