How to get the runtime class?
- From: Fredy <a@xxx>
- Date: Fri, 29 Apr 2005 21:11:34 +0200
I have 2 classes
abstract public class foo {
public void bar() { // i want a Class object of "this"
Class c = this.getClass(); // here i get a class of type foo, even if the runtime class is type foo2
}
}
public class foo2 extends foo {.... }
with other words, how to get the children object from the parent object? .
- Follow-Ups:
- Re: How to get the runtime class?
- From: Abhijat Vatsyayan
- Re: How to get the runtime class?
- From: Matt Humphrey
- Re: How to get the runtime class?
- From: Robert
- Re: How to get the runtime class?
- From: Patricia Shanahan
- Re: How to get the runtime class?
- Prev by Date: Re: Java Threads
- Next by Date: Re: How to synchronize 4 threads.
- Previous by thread: How to synchronize 4 threads.
- Next by thread: Re: How to get the runtime class?
- Index(es):