www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcfoundation/@interfaceobject/super.m

    function varargout = super(obj, calledfrom, varargin)
%SUPER Call a method in the parent class context of an object
%
%  OUT = SUPER(OBJ, CALLEDFROM, VARARGIN)
%  
%  OBJ is the subclass object that we are going to dispatch from. 
%  CALLEDFROM is returned from mfilename('fullpath') in the function calling this
%  VARARGIN are the args to dispatch with.
%
%  This function is called from derivedObject.aMethod to dispatch a call to
%  baseClass.aMethod.

%  Copyright 2004-2010 The MathWorks, Inc.

% This code is a wrapper around mbcSuperClassMethod to ensure correct
% dispatching from a given sub-class to a particular super class

[path, method] = fileparts(calledfrom);
% Get the package and class from the file name
[ path, class] = fileparts(path);
[ ~, package ] = fileparts(path);
% 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:mbcfoundation:interfaceobject:InvalidState'));
end

% Make the mex function dispatch the call correctly
[varargout{1:nargout}] = mbcsuperclassmethod(obj, fullname, method, varargin{:});