- Home /
Question about classes [will specify once I know what the name of what I'm looking for is]
Let's say I've got a class,
public class Base{
public int data;
}
two subclasses
public class A : Base{
public int aType_Data;
}
public class B : Base{
public int bType_Data;
}
and a function
public void getData(common_type){
Debug.Log("Basic data: " + data);
}
that has to be able to receive both an A object or a B object, but only has to access the variables that belong to the base class, "Base". Is there any way to have a single function with a single argument that can be any of the two subclasses?
Comment