.


:




:

































 

 

 

 


-




 

, OMT, - . - C++, Eiffel Smalltalk.

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

, 5.1.

 

. 5.1.

, ( , ); , ( Microsoft Word).

5.3. C++

 

C++ -- . . C++ ( ), . , C++. , , . - C++. // DiaSoft Ltd., 1995.

 

, - (, OMT), C++ , , . , , , . , C++ Window, 5.1. , C++ OMT.

class Window{public:// Window (Length x0, Length y0, Length width, Length height);// ~Window ();// void add_box (Length x, Length y, Length width, Length height);void add_circle (Length x, Length y, Length radius);void clear_selections ();void cut_selections ();Group* group_selections ();void move_selections (Length deltax, Length deltay);void redraw_all ();void select_item (Length x, Length y);void ungroup_selections ();private:Length xmin;Length ymin;Length xmax;Length ymax;void add_to_selections (Shape* shape);};

C++ , ; . (public), (private); , . , ( add_to_selections) , ; , C++ ( ).

Length ( -, # include). typedef. :

typedef float Length;

typedef int Length;

C++ ( ), . . , . , , , , . Window (. 5.1):

 

Window::Window (Length x0, Length y0,Length width, Length height) { xmin = x0; ymin = y0;xmax = x0 + width; ymax = y0 + height; }

(x0,y0), width height. :

Window (Length x0, Length y0);//

Window (); // .

C++ : ( , static), ( , automatic), ( , dynamtic).

, - , static. . , ( ).

Window main_window = Window (0.0, 0.0, 8.5, 11.0)

main_window ( ), .

, , ( ). . , new , . :

Window *window = new Window (0.0, 0.0, 8.5, 11.0);

new Window (0.0, 0.0, 8.5, 11.0) .

, . , , , , (~):

Window::~Window (); {

//

}

, , , delete, :

delete window;

delete , C++ , , ( Java , ).

 

C++ () . , : -> :

Shape* shape;

shape->move(dx,dy);

(int, float, char ..), , typedef, , , .

, , , . x y Shape, move:

void Shape::move (Length deltax, Length deltay)

{

x = x + deltax;

y = y + deltay;

}

this, , . :

void Shape::move (Length deltax, Length deltay)

{

this->x = this->x + deltax;

this->y = this->y + deltay;

}

( ):

window->xmin = x1;





:


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


:

:

. .
==> ...

1675 - | 1599 -


© 2015-2024 lektsii.org - -

: 0.013 .