// classes.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <windows.h>#include <iostream>#include <string>using namespace std;class MyClass // "class" followed by the name of the class{ // open brace protected: // protected specification: like "private" // except subclasses have direct access. private: // private specification: // write data members and/or functions // that are visible only inside an object int val; // example of a data member public: // public specification: // write data members (rare) and functions // accessible directly from the object. int get_val(); // example of a member // function declaration MyClass(int data); // declaration of class constructor ~MyClass(); // declaration of class destructor}; // close brace AND semicolonint MyClass::fn(){return val;} // member function defined outsideMyClass::MyClass(int data){val = data;} // constructor definitionMyClass::~MyClass(){} // destructor definitionint _tmain(int argc, _TCHAR* argv[]){ MyClass newobject(4); int a = newobject.get_val(); cout << a << endl; return 0;}