#include using namespace std; class WhyT{ private: WhyT(); }; class Counter { public: Counter(string n = "no name passed") { name = n; cout << "In the constructor of counter " << name << endl; } ~Counter() { cout << "In the destructor of counter " << name << endl; } void Increment(void) { count ++; } int Count(void) const { return count; } static void Greeting(void) { cout << "Hello form the counter class " << endl; } static void Greeting2(const Counter & c) { cout << "I was passed a counter with value " << c.count << endl; } private: string name; //int count = 0; int count{0}; }; void Function(); int main() { cout << "Entering main" << endl << endl; Counter::Greeting(); Counter a; Counter::Greeting2(a); //WhyT x; int i; for(i =0; i < 3; i++) { Function(); } cout << "Exiting main" << endl << endl; return 0; } void Function(){ cout << "\tIn the call to Function " << endl; static int access{0}; int foo{7}; static Counter count("static"); Counter count1("not-static"); access++; foo++; count.Increment(); cout << "\t\tfoo is " << foo << endl; cout << "\t\taccess is " << access << " counter is " << count.Count() << endl; cout << "\texiting the function" << endl << endl; return; }