• 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
Objective-C++ and overloading and inheritance of static member functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Objective-C++ and overloading and inheritance of static member functions


  • Subject: Objective-C++ and overloading and inheritance of static member functions
  • From: Andrew White <email@hidden>
  • Date: Fri, 22 Apr 2005 11:58:18 +1000


A.h:

class A
{
	static void
		f (const char * src);
	static void
		f (int);
}


B.h:

#import <Foundation/Foundation.h>

class B
{
	using A::f;
	static void
		f (NSString * src)
		{
			f ([src UTF8String]);
		}

	...
}


The above to me seems comparable to:
http://www.research.att.com/~bs/bs_faq2.html#overloadderived
The only difference is the use of static members. However, when I attempt to use B::f, I am told that it doesn't exist and the options are the two functions in A::f.


eg

B.mm

void
B::applyF (NSString * src)
{
	f (src);
}

->

error: no matching function call to A::f (NSString *).
...


Why is it only trying to find A::f when B::f is also in scope? What have I missed?


I can work around it by explicitly scoping the call to B::f (NSString *), but that sort-of defeats the point of overloading.

--
Andrew White

--------------------------------------------------------------------------
This email and any attachments may be confidential. They may contain legally
privileged information or copyright material. You should not read, copy,
use or disclose them without authorisation. If you are not an intended
recipient, please contact us at once by return email and then delete both
messages. We do not accept liability in connection with computer virus,
data corruption, delay, interruption, unauthorised access or unauthorised
amendment. This notice should not be removed.
_______________________________________________
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


  • Prev by Date: How to use a framework? (*solved*)
  • Next by Date: Re: How to use a framework? (newbie)
  • Previous by thread: How to use a framework? (*solved*)
  • Next by thread: Objective-C++ and overloading and inheritance of static member functions
  • Index(es):
    • Date
    • Thread