.


:




:

































 

 

 

 





private, public protected . :

class Employee: public Person

, . . (private) (protected) ,

:

Class C { private: int a; protected: int b; public: int c; }; Class C1: public C {   protected public }; Class C2: protected C {   protected protected }; Class C3: private C {   private private };

 

: ; : . , public, private.

 

17. //this

- , :

class X {

int m;

public:

int readm() { return m; }

};

void f(X aa, X bb)

{

int a = aa.readm();

int b = bb.readm();

//...

}

readm() m aa.m, - bb.m.

- , , . this. , - X this

X *const this;

, , - . , (*const). , .. this - . X:

class X {

int m;

public:

int readm() { return this->m; }

};

this . this -, .

 

delete .

 

().

().

 

 

 

 





:


: 2015-10-01; !; : 468 |


:

:

- , - .
==> ...

1303 - | 1240 -


© 2015-2024 lektsii.org - -

: 0.007 .