devxlogo

Change the Private Variable Outside of a Member Function Definition

Change the Private Variable Outside of a Member Function Definition

Use the following code to change the private variable outside of a member function definition:

class test{int x;public:test():x(0){}int& getx(){return x;}};int main(){test t(10);cout

devx-admin

Share the Post: