The methods will be different, as they are doing different things. In
effect, you have two separate means of setting the address: directly, and as
part of a memento. Here are a few likely methods:
void init(String name, Address a) {
setName(name);
setAddress(a);
}
void setName(String name) {
variables.instance.name = name;
}
void setAddress(Address a) {
variables.instance.address = a;
}
String getName() {
return variables.instance.name;
}
Address getAddress() {
return variables.instance.address;
}
void setMemento(m) {
setName(name);
variables.instance.address.setMemento(m.address);
}
struct getMemento() {
var result = structNew();
result.name = getName();
result.address = variables.instance.address.getMemento();
return result;
}
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Justin Balog
> Sent: Wednesday, December 10, 2003 2:13 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [CFCDev] memento and composition
>
> Barney,
>
> I was thinking that, but lets say my person is composed of an
> address. In
> the init() of the person, I pass in an already created
> address obj. and set
> the persons variables.instance.address = the address obj
> passed in, in the
> case of the setInstanceMemeto() I am passing in a stuct to the
> parent.setInstanceMemento() in that struct is address into
> that I will pass
> to address.setInstanceMemento() in the parent. How should
> this work. The
> init() would have to work behave differently, or am I missing
> something?
>
> Thanks,
>
> Justin
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]