Re: How to make a class an alias of another one?
- From: Mark Space <markspace@xxxxxxxxxxxxx>
- Date: Sat, 30 Aug 2008 09:50:42 -0700
George wrote:
Hi,
I am planning to implement a class (say ClassA) in some special
things. But currently I am not in the stage and it will just be
implement as a String. I can just declare everything in this type
public abstract class ClassA {
// your methods here
public static ClassA getInstance() {
return new Temporary()
}
}
class Temporary extends ClassA {
private String temp;
// implement ClassA methods
}
Now you can declare everything as ClassA and switch implementations when you need easily. Note the lack of "public" on Temporary. It should be in the same package as ClassA.
.
- Follow-Ups:
- Prev by Date: Re: Concurrent, persistent background process for a J2EE container
- Next by Date: Re: Concurrent, persistent background process for a J2EE container
- Previous by thread: Re: How to make a class an alias of another one?
- Next by thread: Re: How to make a class an alias of another one?
- Index(es):
Relevant Pages
|