C++ programming analogy question: Please note: I am looking for a discussion boa
ID: 3583981 • Letter: C
Question
C++ programming analogy question:
Please note: I am looking for a discussion board post---not actual code.
Object oriented programming is considered a difficult ta One speculation is that objects are vague and too broad. For example, if employee is an object, there are many variations of an employee. For example, an employee can be hourly paid, salaried, with commission, with bonus, etc. This makes it difficult for beginners to focus on how objects in programming can represent objects in the real world. One solution to o is to set a plan for each object, which will set specifications and constraints as to what the object is and what is it supposed to do. Discuss how plans can be useful in defining objects, such as employee, or your own example.Explanation / Answer
Plan for employee object used in cooperate industry.
Consider Employee object.We are going to implement Employee class as
class Employee
{
String name, double salary,Date hiredate;
void raiseSalary(double byPercent);
}
Here employee class has 3 member variables name of employee,salary of of employee and hiring date of employee.
We can use Employee class for implementing Manager class.Manager is also employee So that we can use is-a relationship i.e. inheritance.
{
double bonus;
}
Here we are writing different defination for Manager class because salary may be different for different kind of employees.Also Manager includes bonus which we havent included in Employee.
Hence we can plan real life object in programming
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.