How to find out the subclass from the base class object
Posted
by Vaishak Suresh
on Stack Overflow
See other posts from Stack Overflow
or by Vaishak Suresh
Published on 2010-05-18T09:50:26Z
Indexed on
2010/05/18
10:00 UTC
Read the original article
Hit count: 258
Is there a way to find out the derived class's name from a base class object?
ex:
class A{
....
}
class B extends A{
...
}
class c extends A{
...
}
now if a method returns an object of A, can I find out if it is of type B or C?
© Stack Overflow or respective owner