[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
class/subclass ivars
From: |
Riccardo Mottola |
Subject: |
class/subclass ivars |
Date: |
Mon, 11 Jan 2016 16:16:07 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:42.0) Gecko/20100101 Firefox/42.0 SeaMonkey/2.39 |
Hi,
I have a simple question and I am unsure about the answer.
Suppose we have class A with an ivar _var.
Now, I subclass A with B. Since I don't know the declaration of A, I
also need an ivar and call it _var and they probably have the same type.
What happens? Do I get a compiler error? Does the compiler smartly
renames the two variables like _var_A and _var_B? Does the second
declaration get ignored and the code refers to the same variable? I
would expect the renaming behaviour, but the latter also makes
I wonder if there is risk calling vars like "_size" or "width" "height"
which have common names enough to be declared up in the hierarchy.
I am debugging code that works on Mac and not on GS, so I got the doubt.
Riccardo
- class/subclass ivars,
Riccardo Mottola <=