Description of this paper

Instance variables appeared in the lab13_ex

Description

solution


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;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

 

Paper#67233 | Written in 18-Jul-2015

Price : $22
SiteLock