FROM : Andrew White
DATE : Fri Apr 22 03:58:18 2005
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.
DATE : Fri Apr 22 03:58:18 2005
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.
| Related mails | Author | Date |
|---|---|---|
| Andrew White | Apr 22, 03:58 | |
| Jiri Volejnik | Apr 22, 12:17 | |
| Andrew White | Apr 26, 03:10 | |
| Jiri Volejnik | Apr 26, 12:52 |






Cocoa mail archive

