C
Christof Warlich
Hi,
I'd like to define a class that should behave as much as posible
like std::string, but that has some small additional property:
class ExtendedString: public std::string {
public:
void someExtendedFunctionality(void) {}
};
As new classes do not inherit the constructors from its base, is
it true that I would have to define counterparts for all std::string
constructors that I may want to use to construct my derived class?
class ExtendedString: public std::string {
public:
void someExtendedFunctionality(void) {}
ExtendedString(const char *data): std::string(data) {}
ExtendedString(const std::string &data): std::string(data) {}
ExtendedString(void): std::string() {}
// ......
};
Or is there some smarter way to tell the compiler that the constructors
of std::string may be used right away, saving all the typing effort?
Thanks for any tips,
Christof
I'd like to define a class that should behave as much as posible
like std::string, but that has some small additional property:
class ExtendedString: public std::string {
public:
void someExtendedFunctionality(void) {}
};
As new classes do not inherit the constructors from its base, is
it true that I would have to define counterparts for all std::string
constructors that I may want to use to construct my derived class?
class ExtendedString: public std::string {
public:
void someExtendedFunctionality(void) {}
ExtendedString(const char *data): std::string(data) {}
ExtendedString(const std::string &data): std::string(data) {}
ExtendedString(void): std::string() {}
// ......
};
Or is there some smarter way to tell the compiler that the constructors
of std::string may be used right away, saving all the typing effort?
Thanks for any tips,
Christof