[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Class variables not inherited?
From: |
Fernando Diaz |
Subject: |
Re: Class variables not inherited? |
Date: |
Thu, 25 May 2000 09:52:53 -0400 (EDT) |
oh and
3. i am sure the parent class has a -getWorld; method so just call
[self getWorld] in thederived class.
this is probably as elegant as you can get with this sort of thing.
F
On Wed, 24 May 2000, Paul Johnson wrote:
> When a class variable is declared in a the "m" file, before the
> implementation line, it works fine. In order to have that variable be
> inherited by a subclass, what kind of declaration do I need in the "h"
> file. I know its not extern. In case this is unclear, here is a bit of
> code
>
> Agent.m:
>
> #import "Agent.h"
>
> World * worldForAgent;
>
> @implementation Agent
>
> +setWorld: (World *)aWorld;
> {
> worldForAgent = aWorld;
> return self;
> }
>
> Works fine, but subclasses from Agent don't inherit the variable
> worldForAgent.
>
> --
> Paul E. Johnson email: address@hidden
> Dept. of Political Science http://lark.cc.ukans.edu/~pauljohn
> University of Kansas Office: (785) 864-9086
> Lawrence, Kansas 66045 FAX: (785) 864-5700
>
> ==================================
> 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.
>
>
==================================
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.