Вам необходимо включить исходный файл:
#ifndef Session_H
#define Session_H
#include <iostream>
#include "Appointment.h" // or whatever the source file is named
// These really shouldn't be here (namespace pollution)
using std::ostream;
using std::istream;
using std::string;
class Session : public Appointment
{
protected:
string client_id, fname, lname;
int charge;
public:
Session();
string get();
string get_id() const;
string get_fname() const;
string get_lname() const;
int calc_charge();
~Session();
};
#endif
Кроме того, обратите внимание, что включаемые охранники принадлежат на самом верху файла, прежде чем что-то еще (чтобы гарантировать, что абсолютно все, что в нем есть защищен от повторного включения). Другими словами, любой файл, который должен использоваться в качестве заголовка, должен содержать защитные меры. Период.
EDIT
Вот пример того, как вещи могут быть изложены более правильно:
// Appointment.h
#ifndef Appointment_H
#define Appointment_H
#include "Chronos.h" // Or wherever your Date and Time objects are defined
class Appointment
{
protected:
Date date;
Time start_time, end_time;
char description[40], location[40];
public:
Appointment();
void get();
void print() const;
Date get_date() const;
Time get_start_time() const;
Time get_end_time() const;
};
#endif
// Session.h
#ifndef Session_H
#define Session_H
#include <iostream>
#include <string>
#include "Appointment.h"
// These really shouldn't be here (namespace pollution)...
using std::string;
using std::ostream;
using std::istream;
class Session : public Appointment
{
protected:
string client_id, fname, lname;
int charge;
public:
Session();
string get();
string get_id() const;
string get_fname() const;
string get_lname() const;
int calc_charge();
~Session();
};
#endif
// main.cpp
#include "Session.h"
int main()
{
Session session;
}
«Моя проблема в том, что, когда я делаю это, как только я включил Вкладки наследования delinks и больше не может найти Назначение ». что это значит? – HazemGomaa
У вас есть время и дата доступа как общедоступные, поэтому вам не нужно наследовать их доступ! – HazemGomaa