How to define static class members with PROGMEM

I have a long string (web page HTML doc) that I want to be a static string in my class. That is, it will be a static class variable, not a per-instance variable.

I can't figure out how to define this variable in my class so that it is in PROGMEM.

What I can do that does work but isn't desired is to define a global variable with the text, then use this variable in the class methods. However the whole point of using classes is encapsulation so getting the string inside the class is what I'm trying to figure out.

I can see why this has to be a static since PROGMEM operates at compile time not runtime.

I suspect the core problem here is how one initializes member variables inside a class is tricky.

I just cant figure out the initialization syntax for writing a class that does this.

1 Like