[LC++] Not everything inherited with inheritance??
Carlo Wood
carlo at alinoe.com
Fri Jul 20 23:24:48 UTC 2001
On Thu, Jul 19, 2001 at 04:21:53PM +0930, Mark Phillips wrote:
> class tstTy: public string {
...
> main(int argc, char **argv) {
> string str="grape";
> tstTy tst="banana";
...
> tst_main.cpp: In function `int main(int, char **)':
> tst_main.cpp:16: conversion from `const char[7]' to non-scalar type
> `tstTy' requested
...
> Why is this so???
Constructors are not inherited/renamed.
You'd want something like this:
class tstTy: public string {
public:
tstTy(char const* str) : string(str) { }
};
--
Carlo Wood <carlo at alinoe.com>
More information about the tuxCPProgramming
mailing list