#include #include using namespace std; class DemoT{ public: static string Name() { string value = "I am a " + BASE_NAME + " and my number is "; value += to_string(MY_NUMBER); //cout << anum << endl; cout << "bnum is " << bnum << endl; return value; } void ReportAndChange(){ cout << "bnum is " << bnum << endl; bnum++; } static string Name2(); private: static const int MY_NUMBER{7}; static const string BASE_NAME; static const inline string OTHER_NAME{"Fred"}; int anum {5}; static inline int bnum{4}; static int cnum; }; // note no static here. const string DemoT::BASE_NAME{"A DemoT Class"}; int DemoT::cnum{11}; string DemoT::Name2(void) { return DemoT::Name()+ " too!"; } int main() { cout << "The name functions for DemoT: " << endl; cout << DemoT::Name() << endl; cout << DemoT::Name2() << endl; DemoT a,b; a.ReportAndChange(); b.ReportAndChange(); a.ReportAndChange(); return 0; }