Программы на C++. Форум разработчиков
-
Anonymous
Задача библиотеки C++ [закрыто]
Сообщение
Anonymous »
Я создаю консольное приложение библиотеки C++:
Book.h
Код: Выделить всё
#include
#include
using namespace std;
class Reader;
class Book {
protected:
string title;
string author;
int publishingYear;
bool isRented;
Reader* reader;
int returnDate;
public:
Book();
Book(string title, string author, int year);
void printData();
void rentBook(Reader* r,int returnDate);
void returnBook();
bool isAvailable();
string getTitle();
};
Book.cpp
Код: Выделить всё
#include "Book.h"
#include "Reader.h"
using namespace std;
Book::Book()
{
title = "";
author = "";
publishingYear = 0;
isRented = false;
reader = nullptr;
returnDate = 0;
}
Book::Book(string title, string author, int year)
{
title = title;
author = author;
publishingYear = year;
isRented = false;
reader = nullptr;
returnDate = 0;
}
void Book::printData() {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79356257/c-library-task[/url]
1736885745
Anonymous
Я создаю консольное приложение библиотеки C++:
Book.h
[code]#include
#include
using namespace std;
class Reader;
class Book {
protected:
string title;
string author;
int publishingYear;
bool isRented;
Reader* reader;
int returnDate;
public:
Book();
Book(string title, string author, int year);
void printData();
void rentBook(Reader* r,int returnDate);
void returnBook();
bool isAvailable();
string getTitle();
};
[/code]
Book.cpp
[code]#include "Book.h"
#include "Reader.h"
using namespace std;
Book::Book()
{
title = "";
author = "";
publishingYear = 0;
isRented = false;
reader = nullptr;
returnDate = 0;
}
Book::Book(string title, string author, int year)
{
title = title;
author = author;
publishingYear = year;
isRented = false;
reader = nullptr;
returnDate = 0;
}
void Book::printData() {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79356257/c-library-task[/url]