-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathClass_and_Object_2.cpp
38 lines (26 loc) · 1.03 KB
/
Class_and_Object_2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// author: jaydattpatel
#include<iostream>
using namespace std; //std::cout<<"sample"; we do not require to use "std::" duting program
class Employee
{
public:
string name; int salary;
Employee(string n, int s, int sp)
{ this->name = n; this->salary = s; this->secretPassword = sp; }
void printDetails()
{ cout << "The name of our first employee is " << this->name << " and his salary is " << this->salary << " Dollars" << endl; }
void getSecretPassword()
{ cout<<"The secret password of employee is "<<this->secretPassword; }
private:
int secretPassword;
};
class Programmer : public Employee
{ public: int errors; };
int main()
{
Employee rahul("Rahul Verma", 529, 324432); // rahul.name = "Rahul Verma"; rahul.salary = 100;
rahul.printDetails();
rahul.getSecretPassword();
/* cout<<rahul.secretPassword; Private varible can not use in program so error will show*/
return(0);
}