Please solve my problem.
class Book
{
public :
Book() { } // How should i intialize both the array in constructor.
private :
char itsTitle[2][20];
char itsAuthor[2][20];
};
I know the initialization of the above array itsTitle[2][20] can be done as follows :
char itsTitle[2][20]={"C++ Programming","Java Programming"};
But in class we cannot assign we can only declare. Assignment can be done only through member function of that class or constructor of that class. And my question is how to initialize the array itsTitle[2][20] & itsAuthor[2][20] in "constructor of class Book".
解决方案
Well, you could use strcpy[^] in the constructor, can''t you?
I''d also second the recommendation of using an std::string instead of a characte