function [y]=eleve(nom,promo) /// \sleftarrow{\normalfont a Scilab function} [y]=tlist(['Eleve','nom','promo'],nom,promo) /// \sleftarrow{\normalfont \verb+tlist+ is used to build structured and typed object with fields} endfunction el=eleve('Lapeyre',64); /// \sleftarrow{\normalfont creates an object with type \verb+'Eleve'+ } typeof(el) function %Eleve_p(el) /// \sleftarrow{\normalfont overloading display {for} the new type (suffix ``\verb+_p+'')} disp(sprintf('Nom: %s, promo: %d\n',el.nom,el.promo)) /// @@prerequisite /// mprintf(\verb+'Nom: %s, promo: %d\n'+,el.nom,el.promo); endfunction el /// \sleftarrow{\normalfont test the new display } el.nom /// \sleftarrow{\normalfont access to a \verb+tlist+ field }