简体   繁体   中英

How to initialize a static member of a class conveniently?

I have this class

class A
{
public:

static image* Table;
}

So i cant initialize A::Table in class and i can't do it in file with my library. Is there are ways to initiate it without asking a user " Please before start work write " A::Table=nullptr " "??? And how to do A::Table in private section of class then?

I saw similar topics and did not find an answer

Try this

class A
{
private:
    static inline image* Table = nullptr;
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM