Website Summary Files Commits Branches @commit @diff @stats
path: root / Week11 / Exercise03 / main.cpp
blob: d8a4d66ad12cf0425a6a7a157e276856ed6d5efb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "SharedPointer.hpp"
#include <iostream>

void inc(SharedPointer<int> val) {
	(*val)++;
}

int main() {
	SharedPointer<int> x(new int);
	SharedPointer<int> y = x;
	*x = 5;
	std::cout << *x << ' ' << *y << std::endl;
	inc(y);
	std::cout << *x << ' ' << *y << std::endl;

	return 0;
}