Невозможно создать экземпляр абстрактного класса!
Жалуется на PO, OS, и Driver: Невозможно создать экземпляр абстрактного класса
//главный файл
#include <iostream>
#include <Windows.h>
#include <locale>
#include "class.h"
using namespace std;
int main()
{
setlocale(LC_ALL, "");
SetConsoleOutputCP(1251);
SetConsoleCP(1251);
cout << "-----------------------------------Конструктор с параметрами-----------------------------------\n";
PO* po1 = new PO("Фёрст", 2222, 981);
po1->output();
OS* os1 = new OS(1, 2, "Влад", "Шоколад");
os1->output();
Driver* driver1 = new Driver("Первая", 2, "Третья");
driver1->output();
cout << "-----------------------------------Конструктор по умолчанию-----------------------------------\n";
PO* po = new PO();
po->output();
OS* os = new OS();
os->output();
Driver* driv = new Driver();
driv->output();
cout << "-----------------------------------Ввод через сеттеры-----------------------------------\n";
po->input();
os->input();
po->output();
os->output();
cout << "Это были данные об ОС, теперь идём к драйверам: \n";
po->input();
driv->input();
po->output();
driv->output();
delete po;
delete po1;
delete os;
delete os1;
delete driv;
delete driver1;
return 0;
}
//файл класса
#pragma once
using namespace std;
class PO {
protected:
string developer;
int year;
int version;
public:
virtual void pozdnee() = 0;
PO();
PO(string first, int two, int version);
virtual void setDeveloper(string developer) {
this->developer = developer;
};
virtual void setYear(int year) {
this->year = year;
};
virtual void setVersion(int version) {
this->version = version;
};
string getDeveloper();
virtual void input();
virtual void output();
};
class OS : public PO {
private:
int razryad;
int tasks;
string type;
string platform;
public:
OS();
OS(int first, int second, string three, string fourth);
virtual void setRazryad(int razryad) {
this->razryad = razryad;
};
virtual void setTasks(int tasks) {
this->tasks = tasks;
};
virtual void setType(string type) {
this->type = type;
};
virtual void setPlatform(string platform) {
this->platform = platform;
};
virtual void input();
virtual void output();
};
class Driver : public PO {
private:
string devicetype;
long long int indentificator;
string OS;
public:
Driver();
Driver(string first, long long second, string threeth);
virtual void setDevicetype(string devicetype) {
this->devicetype = devicetype;
}
virtual void setIndentificator(long long int indentificator) {
this->indentificator = indentificator;
}
virtual void setOS(string OS) {
this->OS = OS;
}
virtual void input();
virtual void output();
};
#include <iostream>
#include <Windows.h>
#include <locale>
#include <string>
#include "class.h"
using namespace std;
PO::PO() {
//cout << "------------------------------------------КОНСТРУКТОР ПО УМОЛЧАНИЮ------------------------------------------\n";
this->developer = "Digger Online";
this->year = 2001;
this->version = 91;
}
PO::PO(string first, int two, int threeth) {
this->developer = first;
this->year = two;
this->version = threeth;
}
void PO::input() {
string developer;
int year;
int version;
cout << "Разработчик: ";
getline(cin, developer);
//getline(cin, developer);
this->setDeveloper(developer);
cout << "Год выпуска: ";
cin >> year;
while (cin.fail()) {
cin.clear();
cin.ignore();
//cout << "ГОД: ";
cin >> year;
}
cin.ignore();
this->setYear(year);
cout << "Версия: ";
cin >> version;
while (cin.fail()) {
cin.clear();
cin.ignore();
//cout << "Версия: ";
cin >> version;
}
this->setVersion(version);
cin.ignore();
}
string PO::getDeveloper() {
return developer;
}
OS::OS() {
//cout << "------------------------------------------КОНСТРУКТОР ПО УМОЛЧАНИЮ(OS)------------------------------------------\n";
this->setRazryad(64);
this->setTasks(1);
this->setType("ТИП");
this->setPlatform("ПЛАТФОРМА");
}
OS::OS(int first, int second, string three, string fourth) {
//cout << "------------------------------------------КОНСТРУКТОР ПО УМОЛЧАНИЮ(OS)------------------------------------------\n";
this->setRazryad(first);
this->setTasks(second);
this->setType(three);
this->setPlatform(fourth);
}
Driver::Driver() {
this->setDevicetype("Devycetype");
this->setIndentificator(12125125125);
this->setOS("Windows");
}
Driver::Driver(string first, long long second, string threeth) {
this->setDevicetype(first);
this->setIndentificator(second);
this->setOS(threeth);
}
void OS::input() {
//cout << "------------------------------------------ВВОД ДАННЫХ ОБ ОС------------------------------------------\n";
//cout << getDeveloper() << "\n";
int razryad;
int tasks;
string type;
string platform;
cout << "Разряд: ";
cin >> razryad;
while (cin.fail()) {
cin.clear();
cin.ignore();
cout << "Разрядность: ";
cin >> razryad;
}
while (razryad != 32 && razryad != 64) {
cin.clear();
cin.ignore();
cout << "Разряд: ";
cin >> razryad;
}
cin.ignore();
this->setRazryad(razryad);
cout << "Многозадачный?(1 - да; 0 - нет): ";
cin >> tasks;
cin.ignore();
while (tasks < 1 || tasks > 2 || cin.fail()) {
cin.clear();
cin.ignore();
cout << "Многозадачный?(1 - да; 0 - нет): ";
cin >> tasks;
cin.ignore();
}
this->setTasks(tasks);
cout << "Тип: ";
getline(cin, type);
this->setType(type);
cout << "Платформа: ";
getline(cin, platform);
this->setPlatform(platform);
}
//Второй исполняемый файл
void Driver::input() {
//cout << "------------------------------------------ВВОД ДАННЫХ ОБ ОС------------------------------------------\n";
//cout << getDeveloper() << "\n";
string type;
string OS;
long long int indentificator;
cout << "Тип устройства: ";
getline(cin, type);
//cin.ignore();
this->setDevicetype(type);
cout << "Индентификатор: ";
cin >> indentificator;
cin.ignore();
this->setIndentificator(indentificator);
cout << "ОС: ";
getline(cin, OS);
//cin.ignore();
this->setOS(OS);
}
void PO::output() {
cout << this->developer << "\n";
cout << this->year << "\n";
cout << this->version << "\n";
}
void OS::output() {
cout << this->razryad << "\n";
if (this->tasks == 1) {
cout << "Многозадачный" << endl;
}
else cout << "Не многозадачный" << endl;
cout << this->type << "\n";
cout << this->platform << "\n";
}
void Driver::output() {
//cout << developer << " <--------- Пример наследования(да-да, это писал я, Влад Ламеко)\n";
cout << this->devicetype << "\n";
cout << this->indentificator << "\n";
cout << this->OS << "\n";
}