Menu

[Solved]Class Book Private Int Numpages String Title Public Book Void Setbookname String Bn Title Q37290863

class Book
{
private:
int num_pages;
string title;
public:
Book(){ };
void SetBookName(string bn) { title = bn; }

int GetPages(){ return num_pages; }

};

int main()
{
Book myBook;
cout <<myBook.GetPages();
}

which of the following statement is correct?

The code is perfect, the program returns the intintuitively.

The program won’t compile, new_pages is an undeclaredidentifier.

the program is compiled, but the output is garbage.

GetPages() was not defined correctly.

Expert Answer


Answer to class Book { private: int num_pages; string title; public: Book(){ }; void SetBookName(string bn) { title = bn; } int Ge… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *