Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
2.9 kB
1
Indexable
Never
#pragma once
#include <iostream>
#include "string"
#include "vector"
using namespace std;

class Book{
    int ISBNno;
    string name;
    string author;
    float cost;
    int status;
    vector<string> additionalAuthors;
    vector<string> bookcategory;

public:
    Book(int ISBNno,string name,string author,float cost,int status);

    int getISBNno(void)const;
    string getAuthorname(void)const;
    string getBookname(void)const;
    float getcost(void)const;
    void setcost(float cost);
    int getstatus(void)const;

    const vector<string> &getAdditionalAuthors(void)const;
    void addAdditionalAuthor(string author);
    void addAdditionalAuthor(vector<string> authors);

    const vector<string> &getCategories(void)const;
    void addCategories(string category);
    void addCategories(vector<string> categories);



    void Lend();
    void Return();
    void Lost();
    void bookdetails()const;


}; above is book.h an followinng is encylo.h#pragma once
#include <iostream>
#include "string"
#include "vector"
#include "book.h"
using namespace std;

class Encylopedia : public Book{
    int type;
    string publisher;

public:
    Encylopedia(int ISBNno,string name,string author,float cost,int type,string publisher);
    int getType(void) const;
    void setType(int type);
    const string getPublisher(void);

    void Refer(void);
    void Return(void)override;

};and folloeing is encylo.cpp#include "encylo.h"

Encylopedia::Encylopedia(int ISBNno, string name, string author, float cost, int type, string publisher)
:Book(ISBNno,name,author,cost),type(type),publisher(publisher)
{
}

int Encylopedia::getType(void) const
{
    return this->type;
}

void Encylopedia::setType(int type)
{
    this->type=type;
}

const string Encylopedia::getPublisher(void)
{
    return this->publisher;
}

void Encylopedia::Refer(void)
{
    if(this->status == 1){
        this->status =4 ;
    }
}

void Encylopedia::Return(void)
{
    if(this->status == 2 || this->status ==4 ){
        this->status =1 ;
    }
}
following is fiction .h#pragma once
#include <iostream>
#include "string"
#include "book.h"
#include "vector"
using namespace std;

class Fiction : public Book{
    int type;
    string region;

public:
    Fiction(int ISBNno,string name,string author,float cost,int type,string region);
    int getType(void) const;
    const string getRegion(void);
    void  setRegion(string region);

    void Buy(void);
};and following is fiction.cpp #include "fiction.h"

Fiction::Fiction(int ISBNno, string name, string author, float cost, int type, string region)
:Book(ISBNno,name,author,cost),type(type),region(region)
{
}

int Fiction::getType(void) const
{
    return this->type;
}

const string Fiction::getRegion(void)
{
    return this->region;
}

void Fiction::setRegion(string region)
{
    this->region=region;
}

void Fiction::Buy(void)
{
    
}
Leave a Comment