Beginner's Question: Create an identical object.
- From: "sunbin" <noSpam@xxxxxxxxxx>
- Date: Tue, 3 Oct 2006 13:41:57 +0800
Hi all
Need help in understanding this.
Let's say I have 2 class. driver class, and customer class.
In driver class,
[code]
Customer CustA = new Customer(Name, Age);
[/code]
This will create a CustA object.
If I do this...
[code]
Customer CustB = CustA
[/code]
It is actually pointing CustB to CustA, am I right to say that CustA and
CustB is the same object in the memory?
So if yes.
[code]
Customer CustB = new Customer(CustA.getName(), CustA.getAge());
[/code]
Will it work and create another Customer object CustB with the same
attributes of CustA, can it be consider a clone of CustA?
.
- Follow-Ups:
- Re: Beginner's Question: Create an identical object.
- From: Joan C
- Re: Beginner's Question: Create an identical object.
- Prev by Date: Seeking a smarter idiom
- Next by Date: Re: Beginner's Question: Create an identical object.
- Previous by thread: Seeking a smarter idiom
- Next by thread: Re: Beginner's Question: Create an identical object.
- Index(es):
Relevant Pages
|