ECE 220 Lecture 24: Lecture 24 - Intro to C++, Inheritance
Document Summary
Class rectangle { protected: // everything can fall into 3 categories of protection: public, class, private; // friend when two classes are friends, they can use each other"s stuff. // private specified classes can use double x, y; double len, width; public: Rectangle(double x0, double y0, double l, double w); ~rectangle(); double area() const; double intersection(const rectangle &x); Rectangle::rectangle() { x = y = len = width = 0; Rectangle::rectangle(double x, double, y0, double l, double w) { x = x0; y = y0; len = l; width = w; Rectangle::~rectangle() { double rectangle::area() const { return len*width; void rectangle::intersect(const rectangle &x) { /* to implement later*/ class square : rectangle { public: Square::square(double x0, double y0, double l) { x = x0; y = y0; len = width = l; int main() { 5 4 3 | 3 2 1 | 6 5 4 | 4 3 2 | #include int score_current_position(apidgamestate &x) { int i; int max;