|
From: | Fabio Mascelloni |
Subject: | Questions on the return statement |
Date: | Thu, 04 Mar 1999 10:01:33 +0100 |
Then I initialize it to some value:
- intitInstVar:(unsigned) length
{
inst=calloc (
length, sizeof (unsigned));
//init in some
way with some values
return self;
}
After that I implement a method that could be invoked by objects of unrelated classes and that returns the instance variable:
-(unsigned *) getInstVar
{
return inst;
}
The question is: does getInstVar
returns a copy of the object or simply a reference to it ?
If it simply returns a reference,
how can I make it return a copy of the object ?
In J.J Merelo's Breeder there's
a method to get the genotype of a chromosome:
- getGenotype
{
return (id) genotype;
}
where genotype is defined as
unsigned char *genotype.Is this the right way?
Fabio.
[Prev in Thread] | Current Thread | [Next in Thread] |