Programming and Data Types | ![]() ![]() |
Converter Methods
A converter method is a class method that has the same name as another class, such as char
or double
. Converter methods accept an object of one class as input and return an object of another class. Converters enable you to:
A converter function call is of the form
where a
is an object of a class other than class_name
. In this case, MATLAB looks for a method called class_name
in the class directory for object a
. If the input object is already of type class_name
, then MATLAB calls the constructor, which just returns the input argument.
Examples of Converter Methods
See the following sections for examples of converter methods:
![]() | Indexing an Object with Another Object | Overloading Operators and Functions | ![]() |