Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

public: void one(); void two(int, int); // replaces values in aand b with the ne

ID: 3613132 • Letter: P

Question

                 public:

                       void one();

                       void two(int, int);     // replaces values in aand b with the new parameters

                       yClass ();

                 private:

                        int a;

                        int b;

         }

         class xClass: public yClass {

                 public:

                       void one();

                       xClass ();

                 private:

                        int z;

         }

     

         xClass x;

Show how x can initialize yClass’s data membera to 3 and its data member b to 8.

In the above code, if I have xClass obj1, and I callobj1.one(), which function one gets called?

Explanation / Answer

//Hope this will help you. 1. It is done by calling two(3,8) in xClass constructor. 2. It will call the function one which is defined in xClassclass. //here is c++ prog for above class to prove above statements. #includeusing namespace std;class yClass {public:void one(){cout