#oop #inheritance
Вопрос:
файл родительского класса, который создает учетные записи для пользователей
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
class account{
private:
int i=0,id;
string username, password,passCheck,username1,pass,item,itemp;
protected:
string type,type1;
public:
void signup();
void signin();
};
дочерний класс, предоставляющий услуги для пользователей
, я хочу наследовать два атрибута, которые являются типом и типом1
#include <iostream>
#include <fstream>
#include <string>
#include "account.h"
using namespace std;
class services: protected account{
private:
string a,av;
int nights, room_number, i=0, check_in, check_out, chin, chout, room;
public:
void new_reg();
void extend_reg();
void add_services();
};
я получаю эти ошибки:
from main.cpp:6:
account.h:5:7: error: redefinition of ‘class account’
class account{
^~~~~~~
In file included from main.cpp:5:0:
account.h:5:7: error: previous definition of ‘class account’
class account{
^~~~~~~
In file included from services.cpp:3:0:
account.h:5:7: error: redefinition of ‘class account’
class account{
^~~~~~~