Class safeArrayType print function not working when called. Need help!

I've created a function where you can choose any bounds for an array based list (positive or negative, as long as the first position is smaller than the last position). However for some reason when I call the print() function in my application program it doesn't do anything. My print function is technically correct (I still have work to do on the output) but I can't figure out why it wont show anything at all. Below is my header, implementation, and main program files, along with results from running the program. I would REALLY appreciate the help from you guys, and thanks so much in advance.

Header File:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//safearrayType Header File

class safeArrayType
{
public:
	void print() const;
	

	void insertAt(int location, const int& insertItem);
	
	safeArrayType(int firstPlace=0, int maxPlace = 100);
	

	~safeArrayType();
	

private:
	int maxPlace; 
	int firstPlace;
	int *list; 
	int length; 
	
};


Implementation File:
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
#include <iostream>
#include "safeArray.h"
#include <assert.h>

using namespace std;

void safeArrayType::print() const
{
	for (int i = 0; i < length; i++)
	{
		cout << "list[" << firstPlace << "," << maxPlace << "]"  << endl;
			
	}

	cout << endl;
}

void safeArrayType::insertAt(int location, const int& insertItem)
{
	if (location < firstPlace || location >=maxPlace)
	{
		cout << "Position out of range" << endl;
		cout << "safeArrayType list(" << firstPlace << "," << maxPlace << ")" << endl;
	}
	else
		list[location]=insertItem;
}

safeArrayType::safeArrayType(int firstP, int maxP)
{
	maxPlace = maxP;
	firstPlace = firstP;

	list = new int[maxPlace-firstPlace];
	assert(list != NULL);
}

safeArrayType::~safeArrayType() { delete[] list; }


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
#include <iostream>
#include "safeArray.h"

using namespace std;

int main()
{
	safeArrayType mylist = safeArrayType(-2,8);
	mylist.print();

	int yourfirst = 0;
	int yourlast = 0;
	
	cout << "Enter the first bound of yourlist: ";
	cin >> yourfirst;
	cout << "Enter the last bound of yourlist: ";
	cin >> yourlast;
	
	safeArrayType yourlist = safeArrayType(yourfirst, yourlast);

	yourlist.print();

	safeArrayType alist=safeArrayType();
	alist.print();

	return 0;


Results
Enter the first bound of yourlist: -3(this was my input)
Enter the last bound of yourlist: 7(this was my input)

Press any key to continue...
so it's solved?
Topic archived. No new replies allowed.