Chat with us, powered by LiveChat In this exercise, we are going to identify all the instance variables appeared in the lab13 | Writedemy

In this exercise, we are going to identify all the instance variables appeared in the lab13

In this exercise, we are going to identify all the instance variables appeared in the lab13

Question

In this exercise, we are going to identify all the instance variables appeared in the lab13_ex1_starter.cpp, and list its attributes in the same format as shown in the following example:

Data Member of the Classes
Class — Member — Class Access — Inherited from
Pub, mPublic, public, Base
Pub, mProtected, protected, Base
Pub, mmPublic, public, No
Pub, mmPrivate, private, No
Pub, mmProtected, protected, No

Starter: lab13_ex1_starter.cpp

#include <iostream>

class Base
{
public:
int mPublic;
private:
int mPrivate;
protected:
int mProtected;
public:
int get_mPrivate() {return mPrivate;}
int get_mProtected() {return mProtected;}
Base(int pub, int pri, int pro)
{ mPublic = pub; mPrivate = pri; mProtected = pro; }
};

class Pub: public Base
{
public:
int mmPublic;
private:
int mmPrivate;
protected:
int mmProtected;
public:
int get_mmPrivate() {return mmPrivate;}
int get_mmProtected() {return mmProtected;}
Pub(int a, int b, int c, int pub, int pri, int pro) : Base(a, b, c)
{ mmPublic = pub; mmPrivate = pri; mmProtected = pro; }
};

class Pri: private Base
{
public:
int mmPublic;
private:
int mmPrivate;
protected:
int mmProtected;
public:
int get_mmPrivate() {return mmPrivate;}
int get_mmProtected() {return mmProtected;}
Pri(int a, int b, int c, int pub, int pri, int pro) : Base(a, b, c)
{ mmPublic = pub; mmPrivate = pri; mmProtected = pro; }
};

class Pro: protected Base
{
public:
int mmPublic;
private:
int mmPrivate;
protected:
int mmProtected;
public:
int get_mmPrivate() {return mmPrivate;}
int get_mmProtected() {return mmProtected;}
Pro(int a, int b, int c, int pub, int pri, int pro) : Base(a, b, c)
{ mmPublic = pub; mmPrivate = pri; mmProtected = pro; }
};

///// Children of PUB ///////////
class PubOfPub: public Pub
{
public:
int mmmPublic;
private:
int mmmPrivate;
protected:
int mmmProtected;
public:
int get_mmmPrivate() {return mmmPrivate;}
PubOfPub(int a, int b, int c, int d, int e, int f, int pub, int pri, int pro)
: Pub(a, b, c, d, e, f)
{ mmmPublic = pub; mmmPrivate = pri; mmmProtected = pro; }
};

class PriOfPub: private Pub
{
public:
int mmmPublic;
private:
int mmmPrivate;
protected:
int mmmProtected;
public:
int get_mmmPrivate() {return mmmPrivate;}
PriOfPub(int a, int b, int c, int d, int e, int f, int pub, int pri, int pro)
: Pub(a, b, c, d, e, f)
{ mmmPublic = pub; mmmPrivate = pri; mmmProtected = pro; }
};

class ProOfPub: protected Pub
{
public:
int mmmPublic;
private:
int mmmPrivate;
protected:
int mmmProtected;
public:
int get_mmmPrivate() {return mmmPrivate;}
ProOfPub(int a, int b, int c, int d, int e, int f, int pub, int pri, int pro)
: Pub(a, b, c, d, e, f)
{ mmmPublic = pub; mmmPrivate = pri; mmmProtected = pro; }
};

///// Children of PRI ////////////
class PubOfPri: public Pri
{
public:
int mmmPublic;
private:
int mmmPrivate;
protected:
int mmmProtected;
public:
int get_mmmPrivate() {return mmmPrivate;}
int get_mmmProtected() {return mmmProtected;}
PubOfPri(int a, int b, int c, int d, int e, int f, int pub, int pri, int pro)
: Pri(a, b, c, d, e, f)
{ mmmPublic = pub; mmmPrivate = pri; mmmProtected = pro; }
};

class PriOfPri: private Pri
{
public:
int mmmPublic;
private:
int mmmPrivate;
protected:
int mmmProtected;
public:
int get_mmmPrivate() {return mmmPrivate;}
int get_mmmProtected() {return mmmProtected;}
PriOfPri(int a, int b, int c, int d, int e, int f, int pub, int pri, int pro)
: Pri(a, b, c, d, e, f)
{ mmmPublic = pub; mmmPrivate = pri; mmmProtected = pro; }
};

class ProOfPri: protected Pri
{
public:
int mmmPublic;
private:
int mmmPrivate;
protected:
int mmmProtected;
public:
int get_mmmPrivate() {return mmmPrivate;}
int get_mmmProtected() {return mmmProtected;}
ProOfPri(int a, int b, int c, int d, int e, int f, int pub, int pri, int pro)
: Pri(a, b, c, d, e, f)
{ mmmPublic = pub; mmmPrivate = pri; mmmProtected = pro; }
};

///// Children of PRO ////////////
class PubOfPro: public Pro
{
public:
int mmmPublic;
private:
int mmmPrivate;
protected:
int mmmProtected;
public:
int get_mmmPrivate() {return mmmPrivate;}
PubOfPro(int a, int b, int c, int d, int e, int f, int pub, int pri, int pro)
: Pro(a, b, c, d, e, f)
{ mmmPublic = pub; mmmPrivate = pri; mmmProtected = pro; }
};

class PriOfPro: private Pro
{
public:
int mmmPublic;
private:
int mmmPrivate;
protected:
int mmmProtected;
public:
int get_mmmPrivate() {return mmmPrivate;}
PriOfPro(int a, int b, int c, int d, int e, int f, int pub, int pri, int pro)
: Pro(a, b, c, d, e, f)
{ mmmPublic = pub; mmmPrivate = pri; mmmProtected = pro; }
};

class ProOfPro: protected Pro
{
public:
int mmmPublic;
private:
int mmmPrivate;
protected:
int mmmProtected;
public:
int get_mmmPrivate() {return mmmPrivate;}
ProOfPro(int a, int b, int c, int d, int e, int f, int pub, int pri, int pro)
: Pro(a, b, c, d, e, f)
{ mmmPublic = pub; mmmPrivate = pri; mmmProtected = pro; }
};

void BaseDisplay(Base &b) {
std::cout << “nmPublic: ” << b.mPublic
<< ” mPrivate: ” << b.get_mPrivate()
<< ” mProtected: ” << b.get_mProtected();
}

void PubDisplay(Pub &p) {
std::cout << “nmmPublic: ” << p.mmPublic
<< ” mmPrivate: ” << p.get_mmPrivate()
<< ” mmProtected: ” << p.get_mmProtected();
}

void PriDisplay(Pri &p) {
std::cout << “nmmPublic: ” << p.mmPublic
<< ” mmPrivate: ” << p.get_mmPrivate()
<< ” mmProtected: ” << p.get_mmProtected();
}

void ProDisplay(Pro &p) {
std::cout << “nmmPublic: ” << p.mmPublic
<< ” mmPrivate: ” << p.get_mmPrivate()
<< ” mmProtected: ” << p.get_mmProtected();
}

//// Only the 3 Pri Children display ////
void PubPriDisplay(PubOfPri &pp) {
std::cout << “nmmmPublic: ” << pp.mmmPublic
<< ” mmmPrivate: ” << pp.get_mmmPrivate()
<< ” mmmProtected: ” << pp.get_mmmProtected();
}

void PriPriDisplay(PriOfPri &pp) {
std::cout << “nmmPublic: ” << pp.mmmPublic
<< ” mmmPrivate: ” << pp.get_mmmPrivate()
<< ” mmmProtected: ” << pp.get_mmmProtected();
}

void ProPriDisplay(ProOfPri &pp) {
std::cout << “nmmmPublic: ” << pp.mmmPublic
<< ” mmmPrivate: ” << pp.get_mmmPrivate()
<< ” mmmProtected: ” << pp.get_mmmProtected();
}

int main()
{
PubOfPub cPubPub(11,12,13,14,15,16,17,18,19);
PriOfPub cPriPub(21,22,23,24,25,26,27,28,29);
ProOfPub cProPub(31,32,33,34,35,36,37,38,39);
PubOfPri cPubPri(41,42,43,44,45,46,47,48,49);
PriOfPri cPriPri(51,52,53,54,55,56,57,58,59);
ProOfPri cProPri(61,62,63,64,65,66,67,68,69);
PubOfPro cPubPro(71,72,73,74,75,76,77,78,79);
PriOfPro cPriPro(81,82,83,84,85,86,87,88,89);
ProOfPro cProPro(91,92,93,94,95,96,97,98,99);

std::cout << “nnAll (BASE’s grandchildren) instances’ BASE data members:”;
BaseDisplay(cPubPub);
/* BaseDisplay(cPriPub);
BaseDisplay(cProPub);
BaseDisplay(cPubPri);
BaseDisplay(cPriPri);
BaseDisplay(cProPri);
BaseDisplay(cPubPro);
BaseDisplay(cPriPro);
BaseDisplay(cProPro);
*/
std::cout << “nnAll instances’ Parent data members:”;
PubDisplay(cPubPub);
/* PubDisplay(cPriPub);
PubDisplay(cProPub); */
PriDisplay(cPubPri);
/* PriDisplay(cPriPri);
PriDisplay(cProPri); */
ProDisplay(cPubPro);
/* ProDisplay(cPriPro);
ProDisplay(cProPro); */

std::cout << “nnAll Pri’s children instances, their own data members:”;
PubPriDisplay(cPubPri);
PriPriDisplay(cPriPri);
ProPriDisplay(cProPri);

return 0;
}

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order