50 lines
1.4 KiB
C++

#include <iostream>
#include <memory>
#include "SmartPointer.h"
#include "Date.h"
int main() {
std::cout << "Hello, World!\n\n";
Date a(27, 2, 3);
Date b(30, 12, 3);
Date g(1,1,1);
if (a == b)
std::cout << "isto\n";
else
std::cout << "razlicno\n";
std::cout << "----mesec-----------------------------------------------------\n";
std::cout << "a: " << a << "\n";
std::cout << "a: " << a++ << "\n";
std::cout << "a: " << a << "\n";
std::cout << "a: " << ++a << "\n";
std::cout << "a: " << a << "\n";
std::cout << "----leto-----------------------------------------------------\n";
std::cout << "b: " << b << "\n";
std::cout << "b: " << ++b << "\n";
std::cout << "b: " << ++b << "\n";
std::cout << "b: " << b << "\n\n";
g = b + 500;
std::cout << "b: " << b << "\n";
std::cout << "g: " << g << "\n";
std::cout << "----smart pointer-----------------------------------------------------\n";
SmartPointer<Date> c = new Date(1, 2, 3);
std::cout << *c << "\n";
std::cout << ++*c << "\n";
std::cout << (*c)++ << "\n";
std::cout << c->toString() << "\n\n";
std::cout << "----sharedt pointer-----------------------------------------------------\n";
std::shared_ptr<Date> e = std::make_shared<Date>(4,5,6);
std::shared_ptr<Date> f = e;
std::cout << *e << "\n";
(*e)++;
std::cout << *f;
return 0;
}