A class called List that stores its items in a sorted dynamic array. There shoul
ID: 3742599 • Letter: A
Question
A class called List that stores its items in a sorted dynamic array. There should be four classes at the end but honestly I pretty much just need help on List, I'm not sure where to start. I created the class Book and its two derived classes but List is confusing me a bit. Thanks in advance and I'll be sure to give you an upvote.
Class Requirements All classes - Proper use of const throughout your code Create an abstract base class called Boolk - The Book class shall contain within its private/protected section: A string that represents the author's last nameExplanation / Answer
class Book
{
Private:
string lname;
string fname;
string title;
int pub;
public:
Book(string lname,string fname,string title,int pub){
string lname(); const{return lname;}
string fname(); const{return fname;}
string title(); const{return title;}
int pub(); const{return pub;}
}
string author(string l,string f){
this.lname=l;
this.fname=f;
return lname;
return fname;
}
Void title(string t){
this.title=t;
}
Void year(int y){
this.year=y;
}
friend ostream &operator<<(ostream &output,const Book &B){
output<< “Firstname”<<B.fname<<”lastname:”<<B.lname;
}
};
class Novel:public Book{
}
class GraphicNovel:public Book{
public:
void illustrator(string i){
fname=i.substr(0);
lname=i.substr(1);
}
}
Class List{
Void *operator new(size_t size, bool nullify){
Void *buf=malloc(size);
If(!buf){
}
Memset(buf,’’,size);
Return buf;
}
String lt=new(true) string[length];
int main(){
Book *n=new Novel() ;
Book *gn=new GraphicNovel();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.