www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcwidgets/@abstractcomponent/super.m
function varargout = super(obj, method, varargin) %SUPER Call a method in the parent class context of an object % % OUT = SUPER(OBJ, METHOD, VARARGIN) % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. % This code is a wrapper around mbcSuperClassMethod to ensure correct % dispatching from a given sub-class to a particular super class % Firstly, we need to to know from which class method we are being called stack = dbstack('-completenames'); if length(stack)>1 % Get the second MATLAB file on the stack (Note this file is first on the % stack) name = fileparts(stack(2).file); % Get the package and class from the MATLAB file name [ package, class] = fileparts(name); [ ~, package ] = fileparts(package); % Ensure that the package and class name begin with an '@' if isequal(class(1), '@') && isequal(package(1), '@') % Remove the '@' from the front of the directories class = class(2:end); package = package(2:end); % Compose the current class that this method was called from. fullname = [ package '.' class ]; else error(message('mbc:mbcwidgets:abstractcomponent:InvalidState')); end else error(message('mbc:mbcwidgets:abstractcomponent:InvalidState')); end % Possibly nargout == 0 not dispatching correctly yet so use 2 calls if nargout == 0 mbcsuperclassmethod(obj, fullname, method, varargin{:}); else % Make the mex function dispatch the call correctly [varargout{1:nargout}] = mbcsuperclassmethod(obj, fullname, method, varargin{:}); end