[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:41:46 -0400 (EDT) |
yeah you want to make that variable static within the extern file. right
now it's global as i think marcus said. anyway, if you want to pass the
pointer down in inheritence you have two options :
1. you could just have an instance variable which is a copy of the static
variable (set at create time most likely), or
2. leave out the "static" and just extern it in the derived class's
implementation.
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.