PHP Code:
#include <iostream>
#include <string>
using namespace std;
class test {
friend void modify (test * ptr, int b);
public:
test (int ain=0, int bin = 0, int cin=0)
:a(ain),b(bin),c(cin){}
void print (){
cout<< a << endl;
cout<< b << endl;
cout<< c << endl;
}
private:
int a, b, c;
};
void modify (test * ptr, int value){
ptr->a=value;
ptr->b=value;
ptr->c=value;
}
int main (){
test obj;
obj.print();
modify(&obj,50);
obj.print();
return 0;
}