Write a C++ program to declare a class called ‘person’ having data members- ‘name’

c) Write a C++ program to declare a class called ‘person’ having data members- ‘name’,
‘age’ and ‘salary’ of the appropriate types. Write a constructor to define the value of data
variables. Also write a method called display ( ) that will display the current values of
data variables. Create two objects of this class & set their data values as follows:
1. Name: Rakesh, Age: 25, Salary: 20000.00
2. Name: Mitul, Age: 28, Salary: 25000.00


Leave a Reply