This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

initializing a const derived object

I would like to put a derived object in const memory and initialize it like in the example code below.
it works fine as long as _der_test is not derived from _test, if it is, the I get an error

(85): error: initialization with "{...}" is not allowed for object of type "const _der_test"

any idea why and how to solve this ?

class _test
{

};

class _der_test//:public _test
{ public: unsigned char ucVar;

};

_der_test const Param_Config1={1 };
_der_test const Param_Config2={2 };

....etc

0