Answers for "c++ class constructor variable arguments"

C++
0

c++ class constructor variable arguments

struct A {
     template<typename ... Args>
     A(const char * fmt, Args&& ... args) {
          printf(fmt,std::forward<Args>(args) ...);
     };
};

struct B: public A {
  template<typename ... Args>
  B(const char * fmt, Args&& ... args) : A(fmt, std::forward<Args>(args) ...) {}
};
Posted by: Guest on July-31-2021

Browse Popular Code Answers by Language