.


:




:

































 

 

 

 





, (), , . C , , , , , , ( ). ( , Window):

add_to_selections (shape, self)

struct Window* self;

struct Shape* shape;

 

, C, ( ), ( ) ( ). . , - , . C , ; . () :

static struct Window outer_window = {0.0, 0.0, 8.5, 11.0};

, , (&outer_window).

. , . , , ( ), . , , , , ; , .

, . ( malloc alloc) . , ( free). :

struct Window* create_window(xmin, ymin, width, height);

Length xmin, ymin, width, height;

{

struct Window* window;

/* */

window = (struct Window*)malloc(sizeof(struct Window));

/* */

window-> xmin = xmin;

window-> ymin = ymin;

window-> xmax = xmin + width;

window-> ymax = ymin + height;

return window;

};

free , .

 

C . , , Box Circle Shape. C :

struct Shape

{

struct ShapeClass* class;

Length x;

Length y;

};

struct Box

{

struct BoxClass* class;

Length x;

Length y;

Length width;

Length height;

};

struct Circle

{

struct CircleClass* class;

Length x;

Length y;

Length radius;

};

Box Circle , Shape, Box Circle Shape ( Box Circle Shape).

 





:


: 2016-10-06; !; : 319 |


:

:

, , .
==> ...

1893 - | 1533 -


© 2015-2024 lektsii.org - -

: 0.012 .