New (UserStatistics constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:UserStatistics:New subtitle}}
{{Template:UserStatistics:New subtitle}}
The <var>New</var> method creates a new instance of the <var>UserStatistics</var> class, populating it with a snapshot of the user's statistics.


This method
creates a new instance of the UserStatistics class with a snapshot
of the user's statistics.
==Syntax==
==Syntax==
{{Template:UserStatistics:New syntax}}
{{Template:UserStatistics:New syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><i>%ustat</i></th>
<tr><th>%userStatistics</th>
<td>A UserStatistics object variable to contain the new object instance.</td></tr>
<td>A <var>UserStatistics</var> object variable to contain the new object instance.</td></tr>
<tr><th><var>[%(UserStatistics):]</var></th><td>The class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|"Usage notes"]], below, for more information about invoking a <var>UserStatistics</var> <var>Constructor</var>.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>New is a constructor and as such can be called with no object,
<li>As described in [[Object variables#Using New or other Constructors|"Using New or other Constructors"]], <var>New</var> can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is <var>Null</var>:<p class="code">%ustat = new
with an explicit class
 
name, or with an object variable, even if that object is null:
%ustat = %(UserStatistics):new
<p class="code">%ustat = new
 
%ustat = %(userStatistics):new
%ustat = %ustat:new
%ustat = %ustat:new
</p>
</p>
</ul>
</ul>
==See also==
==See also==
{{Template:UserStatistics:New footer}}
{{Template:UserStatistics:New footer}}

Latest revision as of 21:06, 30 November 2011

Create a new UserStatistics instance (UserStatistics class)

The New method creates a new instance of the UserStatistics class, populating it with a snapshot of the user's statistics.

Syntax

%userStatistics = [%(UserStatistics):]New

Syntax terms

%userStatistics A UserStatistics object variable to contain the new object instance.
[%(UserStatistics):]The class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a UserStatistics Constructor.

Usage notes

  • As described in "Using New or other Constructors", New can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is Null:

    %ustat = new %ustat = %(UserStatistics):new %ustat = %ustat:new

See also