1    //
2    // Week 2, Complete Class Example
3    //
4    // Provides an example of a complete class
5    // header file and implementation file
6    //
7   
8    #include "w2ex2.h"
9   
10    foo::foo ()
11    {
12        myData = new int (0);
13    }
14   
15    foo::foo (const foo &source)
16    {
17        myData = new int;
18        *myData = source.getData ();
19    }
20   
21    foo::foo (int theInt)
22    {
23        myData = new int;
24        *myData = theInt;
25    }
26   
27    foo::~foo ()
28    {
29        delete myData;
30    }
31   
32    void foo::setData (int theInt)
33    {
34        *myData = theInt;
35    }
36   
37    int foo::getData () const
38    {
39        return *myData;
40    }
41