super class get callers name

4 visualizaciones (últimos 30 días)
Frank
Frank el 17 de Feb. de 2013
Hi,
when a subclass calls a superclass, is there a way to get the name of the caller (subclass)?
Cheers, Frank.

Respuesta aceptada

Frank
Frank el 19 de Feb. de 2013
Found it. Just call this:
me = class(obj);
this gives the name of the created subclass. I call it in the constructor of the superclass:
function obj = mySuperClass() %constructor
me = class(obj);
obj.name = me;
end

Más respuestas (0)

Categorías

Más información sobre Subclass Definition en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by