Hello. In my library program, I have 3 overloaded book constructors. One is a copy constructor, and the other 2 are normal contructors, which are overloaded. When I try to run my program, it won't let me overload them. Please help!
Library.main.cpp file:
#include <iostream>
#include "library.h"
using namespace std;
int main()
{
library l(2000);
const book book1("Diary of a wimpy kid", "Jeff Kinney", 2000);
const book book2("Percy Jackson and the sea of monsters", "Rick Riordan", 2003);
const book book3("Harry Potter", "JK Rowling", 1997);
const book book4 = book3;
const book book5 = book3;
class book {
private:
std::string title;
std::string author;
int publicationYear;
int ID;
public:
static int numberOfBooksAlreadyCreated;
std::string getTitle() const;
std::string getAuthor() const;
int getPublicationYear() const;
int getID() {return ID;}
book();
book(std::string, std::string, int);
book(const book &);
~book();
};
class library {
private:
book *books;
int maxAmountOfBooks;
int currentAmountOfBooks;
public:
// returning
int returnCurrentAmountOfBooks() {return currentAmountOfBooks;}
// Constructors and destructors
library(int);
~library();
// Methods
void addBook(book);
book getBook(int);
void showBooks();
};
if (currentAmountOfBooks > maxAmountOfBooks)
cout << "You have succeeded the max amount of books! You cannot have more!" << endl;
else
books[currentAmountOfBooks] = Book;
currentAmountOfBooks++;
}
book library::getBook(int Book)
{
if (Book > maxAmountOfBooks || Book < 1)
return books[0];
else
return books[Book];
}
void library::showBooks()
{
for (int i = 0; i < currentAmountOfBooks; i++)
{
cout << "Book " << i + 1 << ": " << getBook(i).getTitle() << endl;
cout << "ID: " << books[i].getID() << endl;
}
}