On Oct 4, 7:58 pm, dog <d...@dog.comwrote:
I want to have a string array as private member, a then in constructor
set the values in array, something like this:
class obj{
string s[];
A C++ array requires a size to be specified for the
number of elements you require.
public:
obj(){
s = {"bla", "blaaa", "..."};
[snip]
You cannot assign to a C++ array like that. You
may be able to assign a new std::string array to
a std::string* pointer, but I don't reccomend it.
I also do not reccomend what you're attempting to
do in the constructor with const string literals.
An appropriae data structure to use here might be a
std::vector<std::string>, which is initialised in the
constructor initialiser list.
--
Chris Val