Created
October 2, 2014 19:09
-
-
Save brianherman/28245fffdcb84f3559bb to your computer and use it in GitHub Desktop.
:)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in file ClassA.cpp | |
#include <stdio.h> | |
class ClassA { | |
public: | |
virtual void f( void ); | |
}; | |
class ClassB : public ClassA{ | |
public: | |
void f( int x = 0); | |
}; | |
void ClassA::f( void ) | |
{ | |
printf("Hello class A"); | |
//implementation is irrelevant | |
} | |
void ClassB::f( int x = 0 ) | |
{ | |
printf("Hello Class B"); | |
//implementation is irrelevant | |
} | |
int main(int argc, char **argv){ | |
ClassA *instanceOfClassB = new ClassB(); | |
instanceOfClassB->f(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment