Re: const Object cannot receive messages in 10.4
Re: const Object cannot receive messages in 10.4
- Subject: Re: const Object cannot receive messages in 10.4
- From: email@hidden
- Date: Thu, 11 Aug 2005 16:17:38 +1000
If I try to send a message to a variable defined as const Object *,
I get a warning: "warning: invalid receiver type 'Object *'". I'm
currently fixing this by removing a bunch of "const" qualifiers
from my code, but am curious as to what is causing the error and
what has changed.
I'm surprised you ever got this working - Objective-C doesn't use the
C++ style for immutable objects, but rather builds [im]mutability
into class design. You'll rarely, if ever, actually want a const
object, since you can't message it.
As an analogy, consider a const class reference in C++, and what
happens when you call any method not qualified as "const" - it won't
work, either. Objective-C has no equivalent "const" qualifier for
methods, that I'm aware of.
I know from my own experience this didn't work on some previous
version of MacOS X - 10.3 or possibly 10.2. Did you do anything
unusual to get the compiler to accept it to start with?
Wade Tregaskis (AIM/iChat, Yahoo, Gizmo & Skype: wadetregaskis, ICQ:
40056898, MSN: email@hidden, AV iChat & email:
email@hidden, Jabber: email@hidden)
-- Sed quis custodiet ipsos custodes?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden