Невозможно создать экземпляр абстрактного класса
От: Egerix  
Дата: 11.11.10 21:40
Оценка: :)))
Object.h

#pragma once
class Object
{
public:
Object(void);
~Object(void);
virtual void show()=0;
};

#include <iostream>
#include "Object.h"
#include "conio.h"
using namespace std;

PAIR.h

class PAIR : public Object
{
protected :
int first;
int second;
public:
PAIR(){};
PAIR(int,int);
PAIR(const PAIR &A);
void Init(int,int);
void Read();
void setFirst(int);
void setSecond(int);
virtual void Show()
{
cout<<"\n A.first="<<PAIR::first;
cout<<"\n A.second="<<PAIR::second;
cout<<"\n";
};
bool operator>(PAIR A);
};


Main.cpp

#include <iostream>
#include "define.h"
#include "Pair.h"
#include "Object.h"
#include "conio.h"
using namespace std;
void main()
{
PAIR A,B; ----------------Выдаёт то что нельзя создать экземпляр абстрактного класса
bool f;
cout<<"\n First par!\n";
A.Read();
cout<<"\n Second par!\n";
B.Read();
A.Show();
B.Show();
getch();
}

Люди добрые помогите пожалуйста, скажите где ошибка, почему он воспринимат класс PAIR как абстрактный?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.