MATLAB Object-Oriented Programming

(Joyce) #1

end
end


The matlab.mixin.CustomDisplay is handle compatible. Therefore, superclasses can
be either handle or value classes.


Default Display — Scalar


Here is the creation and display of a scalar EmployeeInfo object. By default, MATLAB
displays properties and their values for scalar objects.


Provide inputs for the constructor:




Emp123 = EmployeeInfo;
Name: 'Bill Tork'
Job Title: 'Software Engineer'
Department: 'Product Development'
Salary: 1000
Password: 'bill123'




Display the object:




Emp123




Emp123 =


EmployeeInfo with properties:


Name: 'Bill Tork'
JobTitle: 'Software Engineer'
Department: 'Product Development'
Salary: 1000
Password: 'bill123'


Testing for Scalar Objects


To test for scalar objects, use isscalar.


Default Display — Nonscalar


The default display for an array of objects does not show property values. For example,
concatenating two EmployeeInfo objects generates this display:


Class with Default Object Display
Free download pdf