``//this program show the implementation of a sigle class
#include<iostream>
#include<conio.h>
using namespace std;
class Example //class is reserved keyword and "Example is the name of class
{
public:
int first_value;
int second_value; //these are data member of class with "public access modfire"
void setValue(int f,int s) //here i used setter for set value
{
first_value=f;
second_value=s;
}
void show()// this is called inline function also member function becouse it is inside the class
{
cout<<"first_value="<<first_value<<endl;
cout<<"second_value="<<second_value<<endl;
}
};
int main()
{
Example obj; //obj object of the class
obj.setValue(15,25);// set the value of set function by using dot(.) opreator
obj.show();
getch();
return 0;
}
**Output**
first_value=15
second_value=25;Inline Code Example Here
Mady_1 0 Newbie Poster
Reverend Jim 4,968 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
rproffitt 2,662 "Nothing to see here." Moderator
AssertNull 1,094 Practically a Posting Shark
rproffitt 2,662 "Nothing to see here." Moderator
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.