Рассохин Д. От СИ к СИ++

  • Published on
    28-Jul-2015

  • View
    481

  • Download
    7

Embed Size (px)

Transcript

.

++.

++, e ..................................................................................2 ..........................................................................................................................................2 ..............................................................................2 . ...............................................................................3 , .........5 . ..................................................................................5 const volatile ++. ...............................................................................................6 . ...................................................................................................................................................6 .....................................................................................................................10 . .........................................................................11 . ...........................................................................................................................13 ...............................................................................................................................15 ........................................................................................................................16 - ..................................................................18 . . .......................................................................................................................18 ..................................................................................................................22 . ......................................................................................................................................24 ...................................................................................................25 . ........................................................31 .................................................................................................................................39 . . ......................................................................................................40 .....................................................................................................40 ......................................................................................................42 . ............................................................................................................45 . ...........................................................................................48 ..................................................................................48 . ......................................................................................................................................49 -.............................................................................................................49 ..................................................................................................................54 . ...........................................................................................................................55 -. ..............................................................................................56

1

.

++.

1 ++, e . ++ (). , , . , , - ++, .

++ : , , , // . // /* , */ /* - /* */- */ /* - // ! -*/ // - /* !*/ , : = //* */ z; , : = //* */ z;

. , . ++ ( ) . 1. . // '' ++ #include int main() { // ++ "" // for for (int counterl=0; counterl), 13. 13. . class MyClass { // . . . int i; int j; public: int state; int Get_i(); int Get_j(); // //... }; // MyClass // , . 20

.

++.

Int MyClass::Get_i () {return i;} int MyClass::Get_j () {return j;} int main() { ... int m, n, nl ; MyClass obj, objl; // obj obj1 MyClass... MyClass *obj_ptr=&obj ; // ... obj_ptr - MyClass, // obj. m=obj.i; // ! i - ! m=obj_ptr -> i; // ! n=obj.state; // , // -, , . m=obj_ptr-estate; // ... ... m=obj .Get_i( ); // OK! n=obj_ptr -> Get_j(); // OK! nl=objl.Get_j(); //OK! ... } : - , ? , 13 j Get_j? : , Get_j , . , obj1.Get_j() &obj1 : return j ; : return (&obj1)->j; - , , this ( ). ,