C++ Programming Code Examples C++ > Beginners Lab Assignments Code Examples Simple Class in C++ programming language Simple Class in C++ programming language The C++ programming language allows programmers to separate program-specific datatypes through the use of classes. Classes define types of data structures and the functions that operate on those data structures. Instances of these datatypes are known as objects and can contain member variables, constants, member functions, and overloaded operators defined by the programmer. Syntactically, classes are extensions of the C struct, which cannot contain functions or overloaded operators. // Header Files #include <iostream> #include<conio.h> using namespace std; // Class Declaration class person { //Access - Specifier public: //Variable Declaration string name; int number; }; //Main Function int main() { // Object Creation For Class person obj; //Get Input Values For Object Varibales cout << "Enter the Name :"; cin >> obj.name; cout << "Enter the Number :"; cin >> obj.number; //Show the Output cout << obj.name << ": " << obj.number << endl; getch(); return 0; }