xxxxxxxxxx
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) ) {}
};
xxxxxxxxxx
class House {
private:
std::string location;
int rooms;
public:
// Default constructor
House() {
location = "New York";
rooms = 5;
}
// Constructor with parameters
House(std::string loc, int num) {
location = loc;
rooms = num;
}
void summary() {
std::cout << location << " house with " << rooms << " rooms.\n";
}
};