Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( 2 0 pts ) Given the following classes: class CRecyclable { public: void C l s ( ) { cout CR endl;

(20 pts) Given the following classes:
class CRecyclable
{
public:
void Cls(){ cout "CR " endl; }
virtual void Type()=0;
virtual void Unit(){ cout "Pounds " endl; }
virtual void Name()=0;
};
class CPaper : public CRecyclable
{
public:
void Type(){ cout "Paper " endl; }
void Unit(){ cout "Tons " endl; }
virtual void Name(){ cout "Paper "; }
};
class CNewspaper : public CPaper
{
public:
virtual void Type(){ cout "News" endl; }
virtual void Unit(){ cout "Lines " end1; }
virtual void Name(){ CPaper: Name(); cout "New" endl; }
};
For the following code, indicate what each line will output in the blank following the line:
CPaper paper;
CNewspaper news;
CNewspaper *pnews = new CNewspaper();
CRecyclable ?** rec1= &paper;
CRecyclable *rec2= &news;
paper.Type();
news. Type ();
pnews->Type()
rec1->Type();
rec2->Type();
paper.Cls(); =
rec1>Cls();
rec1->Unit();
rec2->Unit();
rec2->Name();
2 points each.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago

Question

Did the team members feel that their work mattered

Answered: 1 week ago