blob: b0b0dae15d8a21a07e09cc8d242386366b912d04 (
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
31
32
33
34
35
36
37
38
39
40
41
|
#include <iostream>
#include "vector.h"
using namespace std;
class Element
{
public:
Element(const Element &o);
Element(int data);
~Element();
int data;
};
Element::Element(const Element &o)
:
data(o.data)
{
cout << "Copy Constructor" << endl;
}
Element::Element(int data) : data(data)
{
cout << "Initialization Constructor" << endl;
}
Element::~Element()
{
cout << "Destructor" << endl;
}
int main()
{
Vector<Element> v;
v.append( Element(2) );
/* Insert 5 duplicate elements at pos 0. */
v.prependDup( Element(1), 5 );
return 0;
}
|