.


:




:

































 

 

 

 





, . , , .

++ static, , . , , , , (static).

. .

 

class Date{

int day;//

int month;//

int year;//

public:

Date (int, int, int); // , ,

Date (int, int); // , ,

Date (int); // ,

Date (); //

...

};

 

, . , , .

. .

 

class Date{

int day, month, year;

static Date default_date;

public:

Date (int d=0, int m=0, int y=0);

...

static void set_default(int, int, int);

};

 

, , default_date. default_date , . - set_default. , - . ,

 

Date Date:: default_date (1, 1, 2000);

void set_default (int d, int m, int y)

{

Date:: default_date= Date (d, m, y);

}

 

++ . , . , . ++ , - .

 

- , , . , , , , , . : . . , .

. : (, ), ( ) ( ). , , . , , . , , . , , , , . , , , ..

, , . . , ( ), , . , . , , , - .

. 4.34.4 , IUser, IApparatus.

 

 

. 4.3. . 4.4.

 

, , . . - . , .

, .

, . , , .

C++ namespace. . , , ( ) .

. , . GraphSys.h:

 

namespace GraphSys{

class Point{... };

class Color{... };

class Shape {... };

class Circle: public Shape{... };

class Triangle: public Shape {... };

class Square: public Shape{... };

class SolidCircle: public Circle {... };

}

 

GraphSys.:

 

namespace GraphSys{

Circle:: draw (){...}

Triangle:: draw (){...}

Square:: draw (){...}

SolidCircle:: draw (){...}

...

}

 

:

 

GraphSys:: Circle C;

GraphSys:: SolidCircle SC;

 

, using :

 

#include GraphSys.h

using namespace GraphSys;

void user_func (){

Circle C;

...

C -> draw ();

}





:


: 2016-07-29; !; : 421 |


:

:

. .
==> ...

762 - | 715 -


© 2015-2024 lektsii.org - -

: 0.022 .