Search:

Type: Posts; User: Norm

Search: Search took 0.19 seconds.

  1. Re: Is it possible to declare 2 different classes in one variable?

    The compiler does not see any Update method in the Object object.
    You can use casting to tell the compiler what class is contained in the Object object.
    ((SomeClass)theObject).theMethod(); //...
  2. Re: Is it possible to declare 2 different classes in one variable?

    Each variable is declared as one data type. For classes, since all classes extend the Object class, then a variable declared as an Object can be assigned a reference to any class. Primitive...
  3. Re: Is it possible to declare 2 different classes in one variable?

    Are you talking about when one class extends another?
    For example if ClassB extends ClassA
    then a variable declared to hold a reference to a ClassA object can contain a reference to a ClassB...
Results 1 to 3 of 3