-
Notifications
You must be signed in to change notification settings - Fork 0
/
heapcreate.cpp
54 lines (46 loc) · 1.13 KB
/
heapcreate.cpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* =====================================================================================
*
* Filename: heapcreate.cpp
*
* Description: Demonstrating adding objects to the heap
*
* Version: 1.0
* Created: 03/01/13 20:20:11
* Revision: none
* Compiler: gcc
*
* Author: Robert Halliday (rh), [email protected]
* Company: rphhpr
*
* =====================================================================================
*/
#include <iostream>
class SimpleCat
{
public:
SimpleCat();
~SimpleCat();
private:
int itsAge;
};
SimpleCat::SimpleCat()
{
std::cout << "Constructor called." << std::endl;
itsAge = 1;
}
SimpleCat::~SimpleCat()
{
std::cout << "Destructor called." << std::endl;
}
int main()
{
std::cout << "SimpleCat Frisky..." << std::endl;
SimpleCat Frisky;
std::cout << "SimpleCat *pRags = new SimpleCat..." << std::endl;
SimpleCat * pRags = new SimpleCat;
std::cout << "delete pRags..." << std::endl;
delete pRags;
std::cout << "Exiting, watch Frisky go..." << std::endl;
return 0;
}