Re: Initialize a const pointer to a constant object
Thanks, Jim.
I actually figured that out shortly after posting.
Basically, it was one of those things I knew but it was under my nose.
Thanks.
Jim Langston wrote:
> "Hank stalica" <me@nospam.net> wrote in message
> news:69OdnSPz-J1iJY_anZ2dnUVZ_hSdnZ2d@comcast.com...
>> So I have this class with a private data member:
>>
>> const Floor* const destFloor;
>>
>>
>> I need to initialize f, which I'm trying to do in the constructor
>> initializer list:
>>
>> Rider::Rider(const Floor& f)
>> :destFloor(f)
>
> : destFloor(&f)
>
>> {
>> }
>>
>> Here's my error message:
>>
>> Rider.cpp(17) : error C2440: 'initializing' : cannot convert from 'const
>> Floor' to 'const Floor *const '
>>
>> How do I initialize destFloor?
>>
>> Best Regards,
>> --Hank Stalica
>
>
|