[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
passing pointers to classes
From: |
Steve Emsley |
Subject: |
passing pointers to classes |
Date: |
Mon, 4 Aug 1997 19:30:04 +0100 |
Hi,
I'm sure this is a basic question but I've tried all the options I can
think of without success.
When I'm developing new classes I use a cut down swarm as a test-bed i.e. just
call initSwarm and declare the new class. The class that I'm developing
presently needs to message another class to get some data. My main.m has the
code:
int
main(int argc, char ** argv) {
id theTestSwarm,theLightSwarm;
int i;
initSwarm(argc, argv);
theLightSwarm = [LightModel createBegin: globalZone];
theLightSwarm = [theLightSwarm createEnd];
theTestSwarm = [POModel createBegin: globalZone];
theTestSwarm = [theTestSwarm createEnd];
[theTestSwarm setLightModel: theLightSwarm];
[theTestSwarm run];
return 0;
}
I know that the pointer to the object is OK since I can send messages to it.
In the TestSwarm class I have a method:
-(void)setLightModel: (id) l { lightModel = l; return ; }
so that I can call a method such as:
[lightModel getIrradiance];
Trouble is that I get the following error:
POModel.m:665: warning: cannot find method.
POModel.m:665: warning: return type for `getLightSpace' defaults to id
When I print the id for lightSpace and theLightSwarm, which should be the
same, I get different answers.
Can anyone give me a pointer!
Much appreciated,
Steve
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Steve Emsley Ecosystems Analysis & Management Group
address@hidden University of Warwick, England
http://www.oikos.warwick.ac.uk/~sme/ (+44) (0)1598 753648
-----------------------------------------------------------------------
Life would be so much easier if we could just look at the source code.
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================
- passing pointers to classes,
Steve Emsley <=