• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
constructor cannot be overloaded?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

constructor cannot be overloaded?


  • Subject: constructor cannot be overloaded?
  • From: Rick Mann <email@hidden>
  • Date: Wed, 30 Mar 2011 17:30:59 -0700

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

  • Follow-Ups:
    • Re: constructor cannot be overloaded?
      • From: Rick Mann <email@hidden>
  • Prev by Date: Re: Click in underlying document while sheet displayed?
  • Next by Date: Re: constructor cannot be overloaded?
  • Previous by thread: [SOLVED] Re: Click in underlying document while sheet displayed?
  • Next by thread: Re: constructor cannot be overloaded?
  • Index(es):
    • Date
    • Thread