I'm new to C++, and I want to know if this valid.
So I want to create an array of strings, but I wont know the size of the array I need until a value is passed in to a function within the class I'm working in. So, can I do this:
string sList[];
void init(unsigned int size=1)
{
sList = new string[size];
}
I'm sorry if this is a dumb question, but I'm a Java guy new to C++.
EDIT: This is an assignment that involves me writing an array wrapper class. If I could use vector<>, trust me, I would.
std::vector<>instead of flat arrays?init? There's absolutely positively no reason for that being an assignment requirement, and that will quickly make you unemployable.