General Question
Is it possible in C++ to declare a vector of characters as a private variable in a class header file? If so, why isn't it working for me?
Asked by HeroicZach (195)
September 19th, 2009
When I declare, like this:
class myClass
{
public:
//public functions
private:
vector<char> myVector;
}
The program compiles, but when I set up the default constuctor in the .cpp file that matches up with this .h class header, like this:
myClass::myClass()
{
myVector(‘a’,‘b’,‘c’);
}
…the program does not compile. What’s the deal?
Observing members:
0
Composing members:
0
3 Answers
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.
Have a question?
Ask Fluther!