MATLAB Object-Oriented Programming

(Joyce) #1
Employees

Sales People and Engineers are
subsets of Employees

Te st
Engineers

Sales
People


Engineers

Employees

Base class

Properties
Name
Address
Department

SalesPerson
(is an Employees)

Derived classes

Properties
Commission
Region

Engineer
(is an Employees)

Properties
Products
Te am

Te stEngineer
(is an Engineer)

Properties
Te stStage

The root of the hierarchy is the Employees class. It contains data and operations that
apply to the set of all employees. Contained in the set of employees are subsets whose
members, while still employees, are also members of sets that more specifically define the
type of employee. Subclasses like TestEngineer are examples of these subsets.

Develop the Abstraction


Classes are representations of real world concepts or things. When designing a class,
form an abstraction of what the class represents. Consider an abstraction of an employee
and what are the essential aspects of employees for the intended use of the class. Name,
address, and department can be what all employees have in common.

Hierarchies of Classes — Concepts
Free download pdf