Created
February 25, 2015 08:03
-
-
Save robertwb/da30273dc94a53f9088e to your computer and use it in GitHub Desktop.
http://stackoverflow.com/questions/28573479 sample code
This file contains 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
#ifndef __BaseClass__ | |
#define __BaseClass__ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string> | |
using namespace std; | |
class BaseClass | |
{ | |
public: | |
BaseClass(){}; | |
virtual ~BaseClass(){}; | |
virtual void SetName(string name){printf("in base set name\n");} | |
virtual float Evaluate(float time){printf("in base Evaluate\n");return 0;} | |
virtual bool DataExists(){printf("in base data exists\n");return false;} | |
}; | |
#endif /* defined(__BaseClass__) */ | |
#ifndef __DerivedClass__ | |
#define __DerivedClass__ | |
#include "BaseClass.h" | |
class DerivedClass:public BaseClass | |
{ | |
public: | |
DerivedClass(){}; | |
virtual ~DerivedClass(){}; | |
virtual float Evaluate(float time){printf("in derived Evaluate\n");return 1;} | |
virtual bool DataExists(){printf("in derived data exists\n");return true;} | |
virtual void MyFunction(){printf("in my function\n");} | |
virtual void SetObject(BaseClass *input){printf("in set object\n");} | |
}; | |
#endif /* defined(__DerivedClass__) */ | |
#ifndef __NextDerivedClass__ | |
#define __NextDerivedClass__ | |
#include "DerivedClass.h" | |
class NextDerivedClass:public DerivedClass | |
{ | |
public: | |
NextDerivedClass(){}; | |
virtual ~NextDerivedClass(){}; | |
virtual void SetObject(BaseClass *input){printf("in set object of next derived class\n");} | |
}; | |
#endif /* defined(__NextDerivedClass__) */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment