Reputation: 25818
I have th following code:
class A{
//Constructor
public: A(int count,...){
va_list vl;
va_start(vl,count);
for(int i=0;i<count;i++)
/*Do Something ... */
va_end(vl);
}
};
class B : public A{
//Constructor should pass on args to parent
public: B(int count,...) : A(int count, ????)
{}
};
How can I do that?
Note: I would prefer to have call the constructor in the initialization list and not in the constructor body. But if this is the only way, I am also interested to hear how this works!
Thanks
Upvotes: 4
Views: 2962
Reputation: 146940
You cannot forward on to an ellipsis. The second constructor will have to take a va_list
, I think it is.
This would be possible with C++0x's base constructor forwarding, or variadic templates.
Upvotes: 3