Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help creating object files for the following classes. I am a beginner and need to understand : #ifndef AUTHOR _ NARRATOR _ H
I need help creating object files for the following classes. I am a beginner and need to understand : #ifndef AUTHORNARRATORH
#define AUTHORNARRATORH
#include
#include
#include "Book.h
class AuthorNarrator
private:
std::string name;
std::vector authoredBooks;
public:
Constructor
AuthorNarratorconst std::string& name;initializes an authornarrator with a given name
Destructor
~AuthorNarrator;cleans up memory for books
Getters
std::string getName const;returns the name of the authornarrator
std::vector getAuthoredBooks const;returns the lists of books by the authornarrato
Setters
void setNameconst std::string& name;sets the name of the authornarrator
Other methods
void addAuthoredBookBook book;adds a book by author narrator
void removeAuthoredBookBook book;removes a book by authornarrator
void listAuthoredBooks const;lists all books by authornarrator
;
#endif AUTHORNARRATORH#ifndef BOOKH
#define BOOKH
#include
#include
class AuthorNarrator; Forward declaration
class Book
private:
std::string title;
std::vector authors;
int publicationYear;
std::string genre;
bool isAvailable;
public:
Constructor
Bookconst std::string& title, int publicationYear, const std::string& genre;
Destructor
~Book;
Getters
std::string getTitle const;
std::vector getAuthors const;
int getPublicationYear const;
std::string getGenre const;
bool getAvailability const;
Setters
void setTitleconst std::string& title;
void setAuthorsconst std::vector& authors;
void setPublicationYearint publicationYear;
void setGenreconst std::string& genre;
void setAvailabilitybool available;
Other methods
void addAuthorAuthorNarrator author;Adds an author to the book's list of authors
void removeAuthorAuthorNarrator author;Removes an author the book's list of authors
void borrowBook;Handles the process of borrowing the book
void returnBook;Handles the process of returning the book
;#ifndef LIBRARYH
#define LIBRARYH
#include
#include
#include "Book.h
class Library
private:
std::string name;
std::vector books;
public:
Constructor
Libraryconst std::string& name;initializes a library with a given name
Destructor
~Library;cleans up memory for book
Getters
std::string getName const;returns the name of the library
std::vector getBooks const;returns the list of books in the libary
Setters
void setNameconst std::string& name;sets the name of the library
Other methods
void addBookBook book;add a book to the library's collection
void removeBookBook book;removes a book from the library's collection
void listBooks const;lists all books in the library
Book findBookByTitleconst std::string& title const;finds a book by it's title in the library
;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started