Mercurial > octave
changeset 23182:8a37443f1a7b
doc: Document second input argument of display (bug #49794)
* libinterp/corefcn/pr-output.cc (Fdisplay): Add documentation for second input
argument "name", which is the name of the variable passed by the Octave
interpreter. Improve guide for class overloading.
author | Kai T. Ohlhus <k.ohlhus@gmail.com> |
---|---|
date | Mon, 13 Feb 2017 23:33:48 +0100 |
parents | 78f04a9dfeee |
children | 05cfbffd5f79 |
files | libinterp/corefcn/pr-output.cc |
diffstat | 1 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc Mon Feb 13 18:53:01 2017 +0100 +++ b/libinterp/corefcn/pr-output.cc Mon Feb 13 23:33:48 2017 +0100 @@ -3598,20 +3598,29 @@ DEFUN (display, args, , classes: cell char double function_handle int8 int16 int32 int64 logical single struct uint8 uint16 uint32 uint64 doc: /* -*- texinfo -*- -@deftypefn {} {} display (@var{obj}) -Display the contents of the object @var{obj}. +@deftypefn {} {} display (@var{obj}) +@deftypefnx {} {} display (@var{obj}, @var{name}) +Display the contents of the object @var{obj} prepended by it's assigned +variable name @var{name}. The Octave interpreter calls the @code{display} function whenever it needs to present a class on-screen. Typically, this would be a statement which does not end in a semicolon to suppress output. For example: @example +myclass (@dots{}) +@end example + +Or: + +@example myobj = myclass (@dots{}) @end example -User-defined classes should overload the @code{display} method so that -something useful is printed for a class object. Otherwise, Octave will -report only that the object is an instance of its class. +User-defined classes should overload the @code{display} method with two +input arguments so that something useful is printed for a class object. +Otherwise, Octave will report only that the object is an instance of its +class. @example @group