Category : Files from Magazines
Archive   : PROGJRNL.ZIP
Filename : RECT.CLS

 
Output of file : RECT.CLS contained in archive : PROGJRNL.ZIP
// rect.cls Rectangle class. uses two Points to define a rectangle.
//
// (c) Aspen Scientific 1989. All Rights Reserved.
// Author: Vaughn Vernon

#ifndef _RECTANGLE_CLASS

# define _RECTANGLE_CLASS 1

# include "point.cls"

// Rectangle class

class Rectangle {

protected:
Point op; // origin Point
Point cp; // corner Point
public:
Rectangle(Point & o, Point & c) { op = o; cp = c; }
Rectangle() { op = Point(0,0); cp = Point(0,0); }
~Rectangle() { }

Point & origin() { return op; }
Point & origin(Point &p){ return op = p; }
Point & corner() { return cp; }
Point & corner(Point &p){ return cp = p; }
Point extent() {
Point p(cp.x() - op.x(), cp.y() - op.y());
return p;
}
int height() { return cp.x() - op.x(); }
int width() { return cp.y() - op.y(); }

// draw() is protocol: derived class responsibility
virtual void draw() { }
};

#endif


  3 Responses to “Category : Files from Magazines
Archive   : PROGJRNL.ZIP
Filename : RECT.CLS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/