consolidate all repos to one for archive
This commit is contained in:
29
semester_2/programiranje_2/primeri/Example34/main.cpp
Normal file
29
semester_2/programiranje_2/primeri/Example34/main.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user