I have multiple classes with different names, but they all have the same variable names. I would like to pass them to a single method and access the variables directly. The example below only shows two but I have many more.
Class1{
float x,y;
MyArrayObj myarrayobj;//this is new'ed.
}
Class2{
float x,y;
MyArrayObj myarrayobj;//this is new'ed.
}
static myGenericMethod(GenericClassObj myObj){
float x = myObj.x;
float pt = myObj.myarrayobj.array[0];
}
Is this possible, or do I have to use "getters/setters' ?
float pt = myObj.myarrayobj[0];.