Hi,
I'm still with my vector and my Book class.
I have a strange behavior during construction of my class.
I my class constructor as 5 parameters it works, if it has 6 parameter,
VC.NET returns me an error :
error C2059: syntax error : ')'
here is code :
class Book
{
public:
std::string Category;
std::string SubCategory;
std::string Title;
std::string Author;
int Pages;
int Year;
std::string Publisher;
std::string Format;
std::string Description;
std::string Language;
std::string Image;
std::string Information;
// constructor
Book(std::string Arg_Category, std::string Arg_SubCategory, std::string
Arg_Title, std::string Arg_Author, int Arg_Pages, int Arg_Year,
std:string Arg_Publisher) : Category(Arg_Category),
SubCategory(Arg_SubCategory), Title(Arg_Title), Author(Arg_Author),
Pages(Arg_Pages), Year(Arg_Year), Publisher(Arg_Publisher)
{
}
};
this work when i use :
std::vector<Book> Books;
Books.push_back(Book("Category_1", "SubCategory_1",
"Title_1","Author_1", 588, 2004, "Publisher_1"));
but if in my class i have as constrcutor:
Book(std::string Arg_Category, std::string Arg_SubCategory, std::string
Arg_Title, std::string Arg_Author, int Arg_Pages, int Arg_Year,
std:string Arg_Publisher, std::string Arg_Format)
: Category(Arg_Category), SubCategory(Arg_SubCategory),
Title(Arg_Title), Author(Arg_Author), Pages(Arg_Pages), Year(Arg_Year),
Publisher(Arg_Publisher),Format(Arg_Format)
{
}
and i initialize it as such :
std::vector<Book> Books;
Books.push_back(Book("Category_1", "SubCategory_1",
"Title_1","Author_1", 588, 2004, "Publisher_1", "Format_1"));
i get error written above :(
so, Is there any limitation for the number of parameters in constructor ?
if yes (and i've never seen it), how can i initialize more parameters ?
thx,
Maileen