I don't know how to sparate the interface and their implement.And I need some help from you.For example,I hope anybody can tell me,how to make these three files to work well.
//This file named main.cpp
#include <iostream>
#include "ABC.h"
using namespace std;
int main(void)
{
char y='y';
char e='e';
char s='s';
ABC yes(y,e,s);
yes.read_a()='t';
//yes.read_c()='p';
cout<<yes.read_a()<<yes.read_b()<<yes.read_c();
}
//This file named ABC.h
#ifndef ABC_H
#define ABC_H
#include "ABC.cpp"
class ABC{
public:
ABC(char inita=0,char initb=0,char initc=0)
:a(inita),b(initb),c(initc){ }
char& read_a();
char& read_b();
const char& read_c();
protected:
char a;
char b;
char c;
};
#endif
//This file named ABC.cpp which implement the interface from ABC.h
#ifndef ABC_H
#define ABC_H
#include "ABC.cpp"
class ABC{
public:
ABC(char inita=0,char initb=0,char initc=0)
:a(inita),b(initb),c(initc){ }
char& read_a();
char& read_b();
const char& read_c();
protected:
char a;
char b;
char c;
};
#endif
Thanks for anybody who help me!My English is poor,I hope that you can understand the means of mine^_^