|
From: | Markus Mützel |
Subject: | [Octave-bug-tracker] [bug #50640] display function not passing arguments to overloaded version of function |
Date: | Wed, 29 Mar 2017 14:12:53 -0400 (EDT) |
User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0 |
Follow-up Comment #22, bug #50640 (project octave): Guillaume, which version of Matlab are you using. I am seeing different results on Matlab R2016a. classdef class1 methods function display (a1) nargin class (a1) inputname (1) disp (a1) end end end classdef class2 methods function display (a1, a2) nargin class (a1) inputname (1) disp (a1) class (a2) inputname (2) disp (a2) end end end Here the results: >> class1() ans = 1 ans = class1 ans = ans class1 with no properties. >> c1=class1() ans = 1 ans = class1 ans = c1 class1 with no properties. >> class2() ans = 2 ans = class2 ans = ans class2 with no properties. ans = char ans = 1 ans = class2 ans = ans class2 with no properties. Not enough input arguments. Error in class2/display (line 9) class (a2) >> c2=class2() ans = 2 ans = class2 ans = c2 class2 with no properties. ans = char ans = 1 ans = class2 ans = c2 class2 with no properties. Not enough input arguments. Error in class2/display (line 9) class (a2) Calling "class2" without output argument calls display with one input argument which fails. I expected calling "class2" with output argument to succeed. However, it fails on "disp(a2)" which in turn calls display with one input argument hence failing. Btw: Matlab's internal editor warns with: "Overloading DISPLAY is not recommended." and advises to overload "disp" instead. _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?50640> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |