+skyler_sdf Posted June 24, 2012 Report Posted June 24, 2012 Datele si metodele declarate public intr o clasa pot fi accesate de oriunde din program. #include<iostream> using namespace std; class my_class { public: int i, j, k; //accesibile ptr tot programul }; int main() { my_class a, b; a.i=100; a.j=4; a.k=a.i*a.j; b.k=12; //ATENTIE, a.k si b.k sunt diferiti cout<<a.k<<" " <<b.k; system("PAUSE"); return 0; }
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now