Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Abstract class - access to parent

807588May 30 2009 — edited May 30 2009
Hi:
I would like to do the following, but I don´t know how (neither if its possible):
Access from an abstract class a method of its implementer class.

public class ContainerClass () implements AbstractClass{
public void AbstractMethod(){
super().Method1();
}
}
public abstract class AbstractClass(){
public void Method1(){
parent.AbstractMethod();
parent.getClassName(); // I am expecting ContainerClass
}
public void AbstractMethod();
}

The method Method1 will be the same for every class implementing AbstractClass, but dependent of the implementation of the AbstractMethod in the container class.
Theoretically, the ContainerClass object should have all the methods implemented in runtime, therefore, all of them accessible in the same object.

Does anybody know how to do this?

Cheers!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 27 2009
Added on May 30 2009
2 comments
147 views