I am fairly new to C++ so this may be an easy one. I created a namespace and inside that namespace is a class. I cannot figure out how to define any of my class's constructors without receiving errors.
#include <iostream>
namespace bill {
const char * null ="EMPTY";
const int MAX_STACK_SIZE = 100;
class myStackClass {
private:
int i;
public:
myStackClass();
myStackClass(int[], int);
int peek();
int pop();
int push(int insertMe);
const char empty[5];
};
}
using namespace bill;
bill::myStackClass::myStackClass() //bill::myStackClass() doesn't work either
:
i(0)
{ //error C2448: 'i' : function-style initializer appears to be a function definition
} //"bill::myStackClass::myStackClass()" provides no initializer for:
const member "bill::myStackClass::empty"
bill::myStackClass::myStackClass(int[],int)
{ //error C2439: 'bill::myStackClass::empty' : member could not be initialized
} //"bill::myStackClass::myStackClass(int *, int)" provides no initializer for:
const member "bill::myStackClass::empty"
int bill::myStackClass::peek() // I am able to call methods belonging to the class
{
}
I'm sorry if any of this information is cluttered and hard to read or just downright not helpful. I have been reading my textbook and googling errors for hours and would really appreciate some insight. Thank you.