TeamMember class example
- Last Updated: January 16, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
The TeamMember.cls that you will import in this course inherits the data
members, methods, and properties of the Emp.cls that you have already
worked with. Its data represents the team members. Displayed here is the code for
the TeamMember class. Notice that the class
statement includes the inherits keyword for inheriting from the
Emp class. Notice that we add using statements for
both the Emp and Manager classes so we can access the
definitions of these classes. The GetInfo() method is typically
inherited by default, but in this example the GetInfo() method is
overridden to include the TeamMember details. In addition, this class
defines an additional method, GetManager(), which is specific to this
class and does not exist in the Emp class. Since this class inherits
from Emp, it has access to the public and
protected data members of the Emp class.
using Progress.Lang.*.
using Enterprise.HR.Emp.
using Enterprise.HR.Role.TeamMember.
using Enterprise.HR.Role.Manager.
block-level on error undo, throw.
class Enterprise.HR.Role.TeamMember inherits Emp:
define private property Mgr as Manager no-undo
get.
set.
constructor public TeamMember ( input pMgr as Manager ):
super ().
assign
EmpType = "TeamMember"
Mgr = pMgr .
end constructor.
method public Manager GetManager():
return Mgr.
end method.
method public override character GetInfo( ):
var char result.
result = super:GetName() + ", Team Member " +
Address + " " + PostalCode + " " +
"Job Title: " + JobTitle + " " +
"Vacation Hours: " + string(VacationHours).
return result.
end method.
end class.