30 lines
953 B
C++
30 lines
953 B
C++
#include <iostream>
|
|
#include "Point.h"
|
|
#include "CPoint.h"
|
|
|
|
int main() {
|
|
Point* t1 = new Point(1,1);
|
|
Point* t2 = new CPoint(1,1,2);
|
|
CPoint* t3 = new CPoint(2,2,2);
|
|
|
|
std::cout << t1->equal(*t1) << std::endl;
|
|
std::cout << t1->equal(*t2) << std::endl;
|
|
std::cout << t1->equal(*t3) << std::endl;
|
|
std::cout << "-------------------" << std::endl;
|
|
/*
|
|
std::cout << t2->equal(*t1) << std::endl;
|
|
std::cout << t2->equal(*t2) << std::endl; // static type is checked for parameters
|
|
std::cout << t2->equal(*t3) << std::endl; // overloading is resolved during compile time
|
|
std::cout << "-------------------" << std::endl;
|
|
|
|
std::cout << t3->equal(*t1) << std::endl;
|
|
std::cout << t3->equal(*t2) << std::endl;
|
|
std::cout << t3->equal(*t3) << std::endl; // overloaded method hide overridden method
|
|
std::cout << "-------------------" << std::endl;
|
|
*/
|
|
delete t1;
|
|
delete t2;
|
|
delete t3;
|
|
return 0;
|
|
}
|