#pragma once
#include <iostream>
#include <iomanip>
#include <string>
#include <stdio.h>
#include <array>
#pragma warning(disable:4996)
using namespace std;
class Date
{
protected:
int month;
int year;
int day;
public:
Date(){ day = 1; month = 1; year = 1900; };
Date(int d, int m, int y)
{
day = d;
month = m;
year = y;
}
virtual void Show(){}
};
class Person : public Date
{
protected:
string name;
string surname;
public:
Person() :Date()
{
name = "Noname";
surname = "Nosurname";
//Date::day = 1;
//Date::month = 1;
//Date::year = 1999;
}
Person(string n, string s, int d, int m, int y) : Date(d, m, y) {
name = n;
surname = s;
}
virtual void Show()
{
cout << "Name: " << name << endl;
cout << "Surname: " << surname << endl;
cout << "Day of birthday: " << day << endl;
cout << "Month of birthday: " << month << endl;
cout << "Year of birthday: " << year << endl;
}
};
class Type_of_file
{
protected:
string type;
public:
Type_of_file()
{
type = "*.txt";
}
Type_of_file(string type);
/*virtual void Show(){
cout << "Type of file: " << type << endl;
}
*/
};
class File : public Type_of_file, public Date
{
protected:
string title;
long int size;
public:
File() : Type_of_file(), Date(){ title = "TITLE"; size = 111111; }
File(string type, int d, int m, int y, string t, long int s) :Type_of_file(t), Date(d, m, y)
{
title = t;
size = s;
}
virtual void Show()
{
cout << "Title of the file: " << title << endl;
cout << "Size of title: " << size << endl;
cout << "Type of file: " << type << endl;
cout << "Day of creating:" << day << endl;
cout << "Month of creating: " << month << endl;
cout << "Year of creating: " << year << endl;
}
};
class Document : public File, public Person, public Date
{
protected:
string file_spesification;
public:
Document() :File(), Date(), Person(){ file_spesification = "SPESIFICATION"; }
Document(File fl, Person per, string fs, int d, int m, int y) :File(fl), Person(per), Date(d, m, y)
{
file_spesification = fs;
}
virtual void Show()
{
File::Show();
Person::Show();
cout << "File spesification: " << file_spesification << endl;
}
};
class List_of_documents : public File
{
protected:
Document *Documents;
int n;
public:
List_of_documents() :File()
{
n = 5;
Documents = new Document[n];
for (int i = 0; i < n; i++)
{
Documents[i] = Document();
}
}
List_of_documents(File fl, Document *doc, int n) :File(fl)
{
this->n = n;
Documents = new Document[n];
for (int i = 0; i < n; i++)
{
Documents[i] = Document(doc[i]);
}
}
List_of_documents(const List_of_documents ©) {
this->n = copy.n;
this->Documents = new Document[this->n];
for (int i = 0; i < this->n; i++) {
this->Documents[i] = copy.Documents[i];
}
}
};
#include <iostream>
#include <string>
#include <iomanip>
#include <stdio.h>
#include "lab6.h"
#pragma warning(disable:4996)
using namespace std;
int main()
{
Person per1("Alexandr", "Laskavyi", 2, 9, 1999);
Person per2("Alina", "Zagrebelnaia", 4, 6, 2000);
File fl1("*.doc", 5, 12, 2016, "Document_1", 23432);
File fl2("*.txt", 14, 9, 2015, "Document_2", 43252);
Document dc1(fl1, per1, "First document", 2, 6, 2018);
Document dc2(fl2, per2, "Second document", 9, 3, 2018);
Document *doc = new Document[2];
doc[0] = dc1;
doc[1] = dc2;
List_of_documents list1(fl1, doc,2);
list1.Show();
system("pause");
return 0;
}
Ошибка:
Ошибка 2 error LNK2019: ссылка на неразрешенный внешний символ "public: __thiscall Type_of_file::Type_of_file(class std::basic_string,class std::allocator >)" (??0Type_of_file@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) в функции "public: __thiscall File::File(class std::basic_string,class std::allocator >,int,int,int,class std::basic_string,class std::allocator >,long)" (??0File@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHH0J@Z) C:\Users\laska_000\Desktop\new_6_laba\new_6_laba\Исходный код.obj new_6_laba
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости