I have a problem that I am trying to solve involving variable argument lists
in C++. I have two classes as shown below (parent and child classes):
class A
{
A(int numargs, ...);
};
class B : public A
{
B(int numargs, ...);
};
How can I pass the variable argument list in B simply to the parent A's
constructor? Currently the solution I am employing is as follows:
class A
{
A() {}
init(int numargs, va_list args) {.........}
};
class B
{
B(int numargs, ...)
{
va_list argptr;
va_start(argptr, numargs);
init(numargs, argptr);
va_end(argptr);
}
};
I am manually calling a function to do the work after converting the
variable list into a va_lst. Is there any way to directly pass the variable
list in class B into class A's constructor? Please help!
Regards
Manohar