ArafatKn.Com

Go Ahead with the Power of Technology

Programming

How To Access private member variables of a class without using its public member functions ? Answerred Using C++

Today i am going to tell you how to access private member variables of a class without using its public function. Method 1:  Using friend function. Consider the following example:- #include<iostream> using namespace std; class A { int a; friend void seta(A &ob,int x); friend int geta(A &ob); }; void seta(A &ob,int x) { ob.a=x; […]

Personal Blog of ARAFAT ISLAM © 2016