Re: Calling getter on const object
Re: Calling getter on const object
- Subject: Re: Calling getter on const object
- From: Kyle Sluder <email@hidden>
- Date: Mon, 8 Nov 2010 09:27:32 -0800
On Mon, Nov 8, 2010 at 8:37 AM, Jonny Taylor <email@hidden> wrote:
> I'm afraid I'm not sure if I understand exactly what you're asking. I would like to be able access the "frame number" property (which is in fact stored as a variable within the class, and is fixed soon after instantiation) in spite of the fact that I only have a 'const' pointer to the object at the time I want to access it. Semantically I don't see why it should be unsafe to attempt to find out the value of that property.
Since you haven't posted enough code for me to reproduce your exact
scenario, I've made a different demo: https://gist.github.com/667967
I don't get the same error you get. Rather, when compiling with GCC I
get "request for member ‘blah’ in something not a structure or union".
With clang, I get no errors at all. Constness doesn't come up here.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden