Overloaded Constructor problems

Having two problems with a program I have been having a hell of a time with. Beginner at programming. Constructor on line 14 of the first file is giving me an error: C:UsersCRBottiniDesktopLab3CBArray.h|14|error: return type specification for constructor invalid|
||=== Build finished: 1 errors, 0 warnings ===||

also lines 109 to 119 in the second file are causing a crash of the program. Any advice is greatly appreciated.
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
#pragma once
#include <string>
#include <iostream>
using namespace std;
/***************
*  CBArray class
****************/
class CBArray
{
    public:
/*********************************************
* Overloaded Constructor for private variables
**********************************************/
        void  CBArray(int newCapacity, bool newResize, int newNumbers, int newNumberSize);
/********************************************
* Set Function Declarations for private variables
*********************************************/
        void setCapacity(int newCapacity);
        void setResize(bool newResize);
        void setNumbers(int newNumbers);
        void setNumberSize(int newNumberSize);

/***********************************************
* Get Function Declarations for private variables
************************************************/
        int getCapacity();
        bool getResize();
        int getNumbers();
        int getNumberSize();
/************************************************
* Function Declaration for array parsing function
*************************************************/
        void processes(string, int);

    private:
/**********************
* Variable Declarations
***********************/
        int capacity;
        bool resize;
        int* numbers;
        int numberSize;
};


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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include "CBArray.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
using namespace std;

void CRArray::setCapacity(int newCapacity)
{
    capacity = newCapacity;
}

void CBArray::setResize(bool newResize)
{
    resize = newResize;
}

void CBArray::setNumbers(int newNumbers)
{
    numbers = newNumbers;
}

void CBArray::setNumberSize(ine newNumberSize)
{
    numberSize = newNumberSize;
}

int getCapacity()
{
    return capacity;
}

bool getResize()
{
    return resize;
}

int getNumbers()
{
    return numbers;
}

int getNumberSize()
{
    return numberSize;
}

void processes(string nextLine, int count)
{
    int capacity = 5;
    bool resize = true;
    int* numbers;
    int numberSize = 0;

	if(count == 1)
	{
		stringstream ss(nextLine);
		ss>>capacity;
		cout << capacity << endl;
	}
	else if(count == 2)
	{

		stringstream ss(nextLine);
		ss>>resize;
		numbers = new int[capacity];
	}
	else if(nextLine[0] == 'p')
		cout << numberSize << '/' << capacity << endl;
	else if(nextLine[0] == 'n')
		cout << "array has "<< numberSize << " elements" << endl;
	else if(nextLine[0] == 'c')
		cout << "array capacity is "<< capacity << " elements" << endl;
	else if(nextLine[0] == 'a')
		{
			if(numberSize<capacity)
			{
			stringstream ss(nextLine.substr(2));
			int value = 0;
			ss>>value;
			numbers[numberSize] = value;
			numberSize++;
			cout << value << " added" << endl;
			}
			else
                cout << "array resized to new capacity " << capacity << endl;
		}

	else if(nextLine[0] == 'i')
        {
            stringstream ss(nextLine.substr(2));
            int value = 0;
            int index = 0;
            ss>>value;
            ss>>index;
            numbers[index] = value;

            cout << value << " inserted at index " << index << endl;
        }

	else if(nextLine[0] == 'g')
        {
            stringstream ss(nextLine.substr(2));
            int index = 0;
            ss>>index;

            cout << "value at " << index << ": " << numbers[index] << endl;
        }
/*
	else if(nextLine[0] == 'r')
        {
            stringstream ss(nextLine.substr(2));
            int index = 2;
            ss>>index;
            for (int i=index+1; i<count; i++)
            numbers[i-1] = numbers[i];
            count--;
        }
*/

	else if(nextLine[0] == '-')
        {
        cout << "-1" << endl;
        }
}
No need to post another thread for this. And as I said, your constructor should not be returning a value.
should it not be void
No, it should be nothing. No return type at all.
Topic archived. No new replies allowed.