Suppose I have three isolated public classes (no IS-A relationship) A, B and C. I want to define a field in C such that it\'s type can either be A or B.
Currently I\'m a
You can't do that but you can set boundaries on what type you want to accept.
If you have
class A extends BaseType {} class B extends BaseType {}
you can define the class C to be
C
class C { ... }
Either a class or an interface as base type work.
class
interface