#include using namespace std; class Student { private: string name; public: static int count;//static member here Student(string = ""); ~Student(); void setName(string na); string getName(void); void printName(); }; int Student::count{0}; //YOU NEED TO INITIALIZE IT HERE! Student::Student(string na) :name{na} { count++; } Student::~Student() { count--; } void Student::setName(string na) { name=na; } string Student::getName() { return name; } void Student::printName() { cout << name << endl; } int main() { Student stu1("Alberto"); stu1.printName(); cout << Student::count << " Student created" << endl;/*This is how you call the member count*/ Student stu2("John"); stu2.printName(); cout << Student::count << " Students created" << endl; Student stu3("Peter"); stu3.printName(); cout << Student::count << " Students created" << endl; stu1.~Student();//This decreases the count to 2 cout << Student::count << " Students created" << endl; stu1.printName();//But beware!!! stu1 has not really been destroyed! }