jeudi 2 août 2018

Why Static data member is not initialized in-class in c++11?

With the new feature of c++11, we are able to do In-class member initialisation. But still static data member cannot be defined in class.

class A
{
    static const int i = 10;
    int j = 10;
    const int k = 20;
    static int m = 10; // error: non-const static data member must be initialized out of line
};

Why this feature is not provided?

Aucun commentaire:

Enregistrer un commentaire