aboutsummaryrefslogtreecommitdiff
path: root/src/tests/constsptr2.cpp
blob: 8ccb20c003c1db95ee19b55c166f6a40d8f83af5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "sptr.h"

void nonsptr()
{
	int a = 5;
	int b = 10;
	const int *p = &a;
	p = &b;
	printf("p = %d\n", (*p) );
	//(*p)++;
}

void sptr()
{
	int a = 5;
	int b = 10;
	const SPtr<int> p = new int(a);
	p = new int(b);
	printf("p = %d\n", (*p) );
	//(*p)++;
}

int main()
{
	printf("Non-sptr:\n");
	nonsptr();
	printf("sptr:\n");
	sptr();
}