Re: Damn sisters :-)
Re: Damn sisters :-)
- Subject: Re: Damn sisters :-)
- From: Ondra Cada <email@hidden>
- Date: Mon, 10 Dec 2001 22:17:30 +0100
Riccardo,
>
>>>>> Riccardo Santato (RS) wrote at Mon, 10 Dec 2001 19:11:47 +0100:
RS> >You are not supposed to have access to another class's data. Create
RS> >accessor methods to access the data. For instance,
RS> >- (id)myInstanceVariable
RS> >{
RS> >return myInstanceVariable;
RS> >}
RS>
RS> I've already thought about this option but I supposed I was rather stupid
RS> to use a "dummy" function just to pass a variable... I hoped there was a
RS> cleaner way :-))
This is actually the very cleanest one, for the excellent reason that you
are free the next year or so to change the implementation so that this will
look like, say
- (id)myInstanceVariable {
return [[myInstanceVariableStorage objectForKey:@"oldInstances] objectAtIndex:3];
}
without breaking backward compatibility the slightest bit. It's one of the
more powerful and nicest OO things ;)
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc