Re: constructor cannot be overloaded?
Re: constructor cannot be overloaded?
- Subject: Re: constructor cannot be overloaded?
- From: Rick Mann <email@hidden>
- Date: Wed, 30 Mar 2011 17:40:20 -0700
Oh, and looks like it's not the first time I've asked this question. Terrifying, since I didn't even have a vague sense of deja vu when looking at it.
--
Rick
On Mar 30, 2011, at 17:36 , Rick Mann wrote:
> Hey! Look at that! Under certain conditions, NSRect is just typedef to be CGRect (as it should've been all along).
>
> Sorry for the noise.
>
> --
> Rick
>
> On Mar 30, 2011, at 17:30 , Rick Mann wrote:
>
>> I have a C++ class I use to wrap CGRect:
>>
>> class
>> Rect : public CGRect
>> {
>> public:
>> Rect();
>> Rect(const Rect& inRect);
>> Rect(const CGRect& inRect);
>>
>> Rect& operator=(const Rect& inRect);
>> Rect& operator=(const CGRect& inRect);
>> .
>> .
>> .
>> };
>>
>> I wanted to extend it to allow easy initialization from NSRect as well, so I added appropriate methods:
>>
>> #if __OBJC__
>> Rect(const NSRect& inRect);
>> Rect& operator=(const NSRect& inRect);
>> #endif
>>
>> But I get a compiler error on these lines:
>>
>> Rect.h:61: error: 'Graphics::Rect::Rect(const NSRect&)' cannot be overloaded
>> Rect.h:59: error: with 'Graphics::Rect::Rect(const CGRect&)'
>>
>> I'm not sure why this should be the case.
>>
>> Any help is much appreciated!
>>
>> --
>> Rick
>>
>> _______________________________________________
>>
>> 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
>
> _______________________________________________
>
> 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
_______________________________________________
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