#include "Englishman.h"
#include "Chinese.h"
int main(int argc, char **argv)
{
Englishman e;
Chinese c;
e.setName("Bill");
c.setName("zhangsan");
e.eating();
c.eating();
return 0;
}
#ifndef _CHINESE_H
#define _CHINESE_H
#include <iostream>
#include <string.h>
#include <unistd.h>
#include "Human.h"
using namespace std;
class Chinese : public Human{
public:
void eating(void);
void wearing(void);
void driving(void);
~Chinese();
};
#endif
#include "Englishman.h"
void Englishman::eating(void)
{
cout<<"use knife to eat"<<endl;
}
void Englishman::wearing(void)
{
cout<<"wear english style"<<endl;
}
void Englishman::driving(void)
{
cout<<"drive english car"<<endl;
}
Englishman::~Englishman()
{
cout<<"~Englishman()"<<endl;
}
#ifndef _HUMAN_H
#define _HUMAN_H
#include <iostream>
#include <string.h>
#include <unistd.h>
using namespace std;
class Human {
private:
char *name;
public:
void setName(char *name);
char *getName(void);
};
#endif
#include "Chinese.h"
void Chinese::eating(void)
{
cout<<"use chopsticks to eat"<<endl;
}
void Chinese::wearing(void)
{
cout<<"wear chinese style"<<endl;
}
void Chinese::driving(void)
{
cout<<"drive chinese car"<<endl;
}
Chinese::~Chinese()
{
cout<<"~Chinese()"<<endl;
}
#include "Human.h"
void Human::setName(char *name)
{
this->name = name;
}
char *Human::getName(void)
{
return this->name;
}
#ifndef _ENGLISHMAN_H
#define _ENGLISHMAN_H
#include <iostream>
#include <string.h>
#include <unistd.h>
#include "Human.h"
using namespace std;
class Englishman : public Human {
public:
void eating(void);
void wearing(void);
void driving(void);
~Englishman();
};
#endif
Human: main.o Chinese.o Englishman.o Human.o
g++ -o $@ $^
%.o : %.cpp
g++ -c -o $@ $<
clean:
rm -f *.o Human
#include "Chinese.h"
int main(int argc, char **argv)
{
Englishman e;
Chinese c;
e.setName("Bill");
c.setName("zhangsan");
e.eating();
c.eating();
return 0;
}
#ifndef _CHINESE_H
#define _CHINESE_H
#include <iostream>
#include <string.h>
#include <unistd.h>
#include "Human.h"
using namespace std;
class Chinese : public Human{
public:
void eating(void);
void wearing(void);
void driving(void);
~Chinese();
};
#endif
#include "Englishman.h"
void Englishman::eating(void)
{
cout<<"use knife to eat"<<endl;
}
void Englishman::wearing(void)
{
cout<<"wear english style"<<endl;
}
void Englishman::driving(void)
{
cout<<"drive english car"<<endl;
}
Englishman::~Englishman()
{
cout<<"~Englishman()"<<endl;
}
#ifndef _HUMAN_H
#define _HUMAN_H
#include <iostream>
#include <string.h>
#include <unistd.h>
using namespace std;
class Human {
private:
char *name;
public:
void setName(char *name);
char *getName(void);
};
#endif
#include "Chinese.h"
void Chinese::eating(void)
{
cout<<"use chopsticks to eat"<<endl;
}
void Chinese::wearing(void)
{
cout<<"wear chinese style"<<endl;
}
void Chinese::driving(void)
{
cout<<"drive chinese car"<<endl;
}
Chinese::~Chinese()
{
cout<<"~Chinese()"<<endl;
}
#include "Human.h"
void Human::setName(char *name)
{
this->name = name;
}
char *Human::getName(void)
{
return this->name;
}
#ifndef _ENGLISHMAN_H
#define _ENGLISHMAN_H
#include <iostream>
#include <string.h>
#include <unistd.h>
#include "Human.h"
using namespace std;
class Englishman : public Human {
public:
void eating(void);
void wearing(void);
void driving(void);
~Englishman();
};
#endif
Human: main.o Chinese.o Englishman.o Human.o
g++ -o $@ $^
%.o : %.cpp
g++ -c -o $@ $<
clean:
rm -f *.o Human