0

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

Geno C
  • 1,401
  • 3
  • 11
  • 26
Kelbon
  • 29
  • 6
  • Does this answer your question? [C++ static member variable and its initialization](https://stackoverflow.com/questions/4547660/c-static-member-variable-and-its-initialization) – Odysseus Aug 21 '20 at 07:47
  • 1
    And why cannot you do it in your library sources? What is wrong with just `image* A::Table = nullptr;` ? – pptaszni Aug 21 '20 at 07:49
  • Can you say what you mean "do it in your library sourses"? – Kelbon Aug 21 '20 at 07:59
  • Can you explain why i need to write a type in initialization, when i write it in class? Its strange – Kelbon Aug 21 '20 at 09:15

1 Answers1

1

Try this

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