.


:




:

































 

 

 

 


. . , (static)




. , (static). , .. . .

_:: _ ;

 

, int complex:: count = 0;

. .

_._

 

, . ,

_:: _

public .

private -. .

_:: __

.

#include <iostream.h>

class TPoint

{

double x,y;

static int N; // - :

public:

 

TPoint(double x1 = 0.0,double y1 = 0.0){N++; x = x1; y = y1;}

static int& count(){return N;} // -

};

int TPoint:: N = 0; // -

void main (void)

{TPoint A(1.0,2.0);

TPoint B(4.0,5.0);

TPoint C(7.0,8.0);

cout<< \n <<TPoint:: count()<<; }

this

 

- , , . this :

_ *const this = _

this . this , . .

this . , - this .

this .

 

- . .

, . ; , - . , .

 

, .

(public, protected).

. :

private . .

protected , private, - , .

public , , public - .

, friend .

:

class _: __

{__};

private, class, public, struct.

private, protected public, .





:


: 2016-11-02; !; : 489 |


:

:

.
==> ...

1359 - | 1200 -


© 2015-2024 lektsii.org - -

: 0.008 .