RectangleShape RectangleShape Objects Objects Examples SimpleWindow W1My Window

Rectangleshape rectangleshape objects objects

This preview shows page 25 - 30 out of 30 pages.

RectangleShape RectangleShape Objects Objects Examples SimpleWindow W1("My Window", 20, 20); SimpleWindow W2("My Other Window", 15, 10); RectangleShape R(W1, 4, 2, Blue, 3, 2); RectangleShape S(W2, 5, 2, Red, 1, 1); RectangleShape T(W1, 3, 1, Black, 4, 5); RectangleShape U(W1, 4, 9);
Image of page 25
RectangleShape RectangleShape Objects Objects Some RectangleShape member functions for processing messages Draw() Causes rectangle to be displayed in its associated window GetWidth() Returns width of object in centimeters GetHeight() Returns height of object in centimeters SetSize() Takes two attributes -- a width and height -- that are used to reset dimensions of the rectangle
Image of page 26
Another Another EzWindows EzWindows Program Program #include <iostream> using namespace std; #include "rect.h“ int ApiMain() { SimpleWindow W("Rectangular Fun", 12, 12); W.Open(); RectangleShape R(W, 5.0, 2.5, Blue, 1, 2); R.Draw(); cout << "Enter a character to exit" << endl; char Response; cin >> Response; return 0; } EzWinProg
Image of page 27
Initialization Initialization Class objects may have several attributes to initialize Syntax for initializing an object with multiple attributes Type Identifier(Exp Type Identifier(Exp 1 , Exp , Exp 2 , ..., , ..., Exp Exp n ); ); SimpleWindow object has several optional attributes SimpleWindow W("Window Fun", 8, 4); First attribute Window banner Second attribute Width of window in centimeters Third attribute Height of window in centimeters
Image of page 28
Home works Home works Page147~150: Exercises 3.11 Exercises 3.17 Exercises 3.19 Exercises 3.21 Exercises 3.25 Exercises 3.28 Exercises 3.30
Image of page 29
End of Chapter 3 End of Chapter 3
Image of page 30

You've reached the end of your free preview.

Want to read all 30 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes