super class get callers name

5 ビュー (過去 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 Center および File ExchangeSubclass Definition についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by