39 lines
773 B
C++
39 lines
773 B
C++
#include <iostream>
|
|
#include "Point.h"
|
|
|
|
int main() {
|
|
Point a;
|
|
Point b(5);
|
|
Point c(4,3);
|
|
Point d(c);
|
|
a.print();
|
|
b.print();
|
|
c.print();
|
|
d.print();
|
|
std::cout << a.distance(c) << std::endl;
|
|
//std::cout << a.distance(5) << std::endl;
|
|
/*
|
|
Point arr[3]; // default constructor is called
|
|
for (int i=0; i < 3; i++)
|
|
arr[i].print();
|
|
*/
|
|
/*
|
|
std::cout << "-----Dynamic allocation-----" << std::endl;
|
|
Point* e = new Point();
|
|
Point* f = new Point(5);
|
|
Point* g = new Point(2,3);
|
|
Point* h = new Point(*g);
|
|
//e.print();
|
|
//*e.print();
|
|
//(*e).print();
|
|
e->print();
|
|
f->print();
|
|
g->print();
|
|
h->print();
|
|
delete e;
|
|
delete f;
|
|
delete g;
|
|
delete h;
|
|
*/
|
|
return 0;
|
|
} |