MATLAB Answers


Dependent properties vs functions

Asked by Saifullah
on 12 Jun 2012

Suppose I have a class that represents rectangles, such that it contains the stored properties 'length' and 'width', and I wish to find the area ... it seems to me that I can define it either as a dependent property (and use the get method to get the area), or as a function (which will return the area).

What is the difference between these two alternatives? After all, to calculate the area for a rectangle object (called rect, say), we would use the same syntax, namely: rect.area

Thanks in advance for your help :-)



No products are associated with this question.

0 Answers

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!