Given codes in language C++
/* file xxx.hpp */
class A
{
};
class B
{
private:
class C
{
static const A a;
};
};
How can I initialize the static constant member variable A a in nested class C?
Add the following to exactly one .cpp:
const A B::C::a;
Note that the posted code was only a declaration: this is the actual definition and initialisation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With