23 lines
503 B
C++
23 lines
503 B
C++
#include <iostream>
|
|
#include "SmartPointer.h"
|
|
#include "Date.h"
|
|
|
|
int main() {
|
|
std::cout << "Hello, World!\n\n";
|
|
|
|
SmartPointer<Date> date1(new Date(6, 5, 2020));
|
|
{
|
|
SmartPointer<Date> date2 = date1;
|
|
}
|
|
std::cout << date1->toString() << std::endl;
|
|
|
|
|
|
SmartPointer<Date> date2(new Date(1, 1, 2019));
|
|
date2 = date1 = date1 = date1 = date1 = date1;
|
|
date2 = date2;
|
|
date2 = date2;
|
|
std::cout << "reference count: " << date2.useCount() << std::endl;
|
|
|
|
return 0;
|
|
}
|