Question: This is an extract from the code fragment: 6 : class A 7 : { 8 : private: 9 : int x; 1 0 :
This is an extract from the code fragment:
: class A
:
: private:
: int x;
: protected:
: int getX;
: public:
: void setX;
: ;
:
: int A::getX
:
: return x;
:
:
: void A::setX
:
: x;
:
The reason why line is a valid access in this code fragment, is because the variable x is a private data member of the class A Private data members can only be accessed by other member functions and operators of the class A getX is a member function of class A and therefore line is a valid access.
Select one:
True
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
