ECE 220 Lecture 24: Lecture 24 - Intro to C++, Inheritance

60 views3 pages

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;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents