c++ - Static member variable initialization -


as posted below. how initialize alphabet using alphabet's own member function static member variable? need initialization within "text.cpp" implementation file.

text.h  class text { private:      struct font {         enum enum {             arial,             menlo,             times         };     };      static alphabet alphabet[3]; // library of letters  }; // class 

i need seen below, correct way of accomplish task. need initialize alphabet once duration of runtime, have made alphabet static. thank you. ^^

text.cpp  alphabet text::alphabet[text::font::arial].load("./alphabet/", "arial", ".xml")); alphabet text::alphabet[text::font::menlo].load("./alphabet/", "menlo", ".xml")); alphabet text::alphabet[text::font::times].load("./alphabet/", "times", ".xml")); 

assuming alphabet has parametrized constructor, can way in single translation unit (in text.cpp file),

alphabet text::alphabet[] = { ("./alphabet/", "arial", ".xml"),                                ("./alphabet/", "menlo", ".xml"),                               ("./alphabet/", "times", ".xml") }; 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -