You're right. Great. I had the syntax wrong when I tested it:
point.cpp file
Code:
#include"point.h"
#include<iostream>
int main()
{
Rectangle rec(2,4,30,50);
Rectangle rec2();
return 0;
}
point.h file:
Code:
#ifndef _point_h
#define _point_h
class Point
{
public:
Point () { _x = 0; _y = 0; }
Point(int x, int y) { _x = x; _y = y; }
~Point () { }
private:
int _x;
int _y;
};
class Rectangle
{
public:
Rectangle() { _width = 0; _height = 0; }
Rectangle (int, int, int, int);
~Rectangle() { }
private:
Point x;
int _width;
int _height;
};
Rectangle::Rectangle (int p1, int p2, int width, int height)
: _width(width), _height(height), x(p1,p2)
{
}
#endif