Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Example Program Simple Class Example Program In C++
SUBMITTED BY:
Nrupeshsinh
DATE:
June 24, 2016, 8:30 a.m.
FORMAT:
Text only
SIZE:
545 Bytes
Raw
Download
Tweet
HITS:
860
Go to comments
Report
#include <iostream>
#include<conio.h>
using namespace std;
// Class Declaration
class person
{
//Access - Specifier
public:
//Varibale 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;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus