Posts

Showing posts with the label OOP

Object of Simple Person

Image
Object of Simple Person: An object of a simple person with some attributes and behaviors are defined here in this post. You can also Download the code of this program easily at the end of the article. Object of Simple Person(Code) #include<iostream> #include<string> using namespace std; class person{ //attributes string name; float age; string reg; //behaviour public: void inputdetail(){ cin>>name>>age>>reg; } void displaydetail(){ cout<<name<<" "<<age<<" "<<reg<<" "<<endl; } }; Go to below to get full code _________________________________________________________________________________ _________________________________________________________________________________ Download: To download this program click on the given link below: Download

Employee Object using classes

Image
Employee Object using classes: In this post we will tell you how to make an object in C++ using classes. In this post we have created an object of an employee with some attributes name, employee no., salary and also with behaviors display and update info (setter and getter) functions.  Employee Object using classes code: #include<iostream> #include<string> using namespace std; class employee{ string name; int employee_no; float salary; public: employee(){ name="AbuZar"; employee_no=105; salary=150000; }; void display_info(); void update_info(); }; To get the complete code click on the given download link in the download segment. Download: To download this code click on the given link below: Download Now