super class get callers name

3 次查看(过去 30 天)
Frank
Frank 2013-2-17
Hi,
when a subclass calls a superclass, is there a way to get the name of the caller (subclass)?
Cheers, Frank.

采纳的回答

Frank
Frank 2013-2-19
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Subclass Definition 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by