13-ClasssDefaultParamsCopy

# 13-ClasssDefaultParamsCopy - #include using...

This preview shows pages 1–3. Sign up to view the full content.

#include <iostream> using namespace std; class Point { private: float x, y; public: Point(float x1 = 0.0f, float y1 = 0.0f) // faciliatates as the default constructor { setCoordinates(x1, y1); } void setCoordinates(float x1, float y1) { x = x1; y = y1; } float getX() { return x; } float getY() { return y; } void print() { cout << "(" << x << ", " << y << ")" << endl; } }; class Quadralateral { private: Point p1, p2, p3, p4; public: Quadralateral() {} Quadralateral(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { p1.setCoordinates(x1, y1); p2.setCoordinates(x2, y2); p3.setCoordinates(x3, y3); p4.setCoordinates(x4, y4); } void print() { cout << "P1: "; p1.print(); cout << "P2: "; p2.print(); cout << "P3: "; p3.print(); cout << "P4: "; p4.print(); } void setP1(float x1, float y1) {

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
p1.setCoordinates(x1, y1); } }; class start { public: start():startVar(0){} int startVar; }; class middle { public: start middleVar; }; class end { public: middle endVar; }; int main (void)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

13-ClasssDefaultParamsCopy - #include using...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online