class
- :
classname =class(obj)¶ - :
cls =class(s, classname)¶ - :
cls =class(s, classname, parent1, …)¶ Return the class name of obj, or build an object of a legacy class.
With one argument, the name of the class of obj is returned as a string. Built-in values answer with names such as
"double","char"or"cell"; objects answer with the name they were constructed with.With two or more arguments, a new object is built from the structure array s. This is allowed only from the constructor of class classname (or from one of its methods), that is, from a function stored in the class directory whose name is classname preceded by an at sign. Every further argument must itself be an object; it becomes a parent of the new class, and the resulting object stores it in a field named after the parent’s class.
Objects of one class must always have the same fields and the same parents in the same order.