Skip navigation.
 
mlRe: Objective-C++ and overloading and inheritance of static member functions
FROM : Jiri Volejnik
DATE : Tue Apr 26 12:52:52 2005

Hmm, strange...
I have no trouble to compile and run the code below with Xcode 1.5.
-- Jirka

>> In Bjarne's example, B is derived from A.

> Uh, yeah.  It is in mine, too.  Throw in a ": public A" after the
> "class B" and repeat the question. :)
> --
> Andrew White


// main.mm
#import <iostream>
#import <Foundation/Foundation.h>

class A {
public:
   static void f(const char* s) { std::cout << s << std::endl; }
   static void    f(int n) { std::cout << n << std::endl; }
};

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

int main (int, char* const[])
{
   NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
   NSString* s = @"Hi";

   B::f(s);
   B::applyF(s);

   [pool release];
}

Related mailsAuthorDate
mlObjective-C++ and overloading and inheritance of static member functions Andrew White Apr 22, 03:58
mlObjective-C++ and overloading and inheritance of static member functions Jiri Volejnik Apr 22, 12:17
mlRe: Objective-C++ and overloading and inheritance of static member functions Andrew White Apr 26, 03:10
mlRe: Objective-C++ and overloading and inheritance of static member functions Jiri Volejnik Apr 26, 12:52