I'm little confused.. My Code is Below
#include <iostream>
using namespace std;
class Test {
private:
int x, y;
public:
void get(){
cin>>x;
cin >>y;
cout << x;
cout << y;
}
};
int main ()
{
Test obj;
obj.get();
return 0;
}
In this code I'm accessing private members using cin..!! Is it fine? because I think user can send values or access private members directly after program run..!!
Aucun commentaire:
Enregistrer un commentaire