classdeclare.hlp

来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· HLP 代码 · 共 93 行

HLP
93
字号
{smcl}
{* 29mar2005}{...}
{cmd:help classdeclare}
{hline}

{title:Appendix C.1:  Class declaration}

	{cmd:class} [{it:newclassname}] {cmd:{c -(}}

	    [{opt class:wide}{cmd::}]

		[{it:type} {it:mvname} [{cmd:=} {it:rvalue}]]

		[     {it:mvname}  {cmd:=} {it:rvalue} ]

		[...]

	    [{opt instance:specific}{cmd::}]

		[{it:type} {it:mvname} [{cmd:=} {it:rvalue}]]

		[     {it:mvname}  {cmd:=} {it:rvalue} ]

		[...]

	{cmd:{c )-}} [{cmd:, inherit(}{txt:{it:classnamelist}}{cmd:)} ]


{pstd}
where

{pmore}
{it:mvname} stands for member variable name.

{pmore}
{it:rvalue} is defined in {help classassign}.

{pmore}
{it:type} is {c -(}{it:classname} | {cmd:double} | {cmd:string} | {cmd:array}{c )-}.


{pstd}
The {cmd:.Declare} built-in may be used to add a member variable
to an existing class instance:

	{cmd:.}{it:id}[{cmd:.}{it:id}[...]] {cmd:.Declare} {it:type} {it:newmvname} [{cmd:=} {it:rvalue}]

	{cmd:.}{it:id}[{cmd:.}{it:id}[...]] {cmd:.Declare} {it:newmvname} {cmd:=} {it:rvalue}

{pstd}
where {it:id} is {c -(}{it:name} | {it:name}{cmd:[}{it:exp}{cmd:]}{c )-}, the
latter being how you refer to an array element; {it:exp} must evaluate to a
number.  If {it:exp} evaluates to a noninteger number, it is truncated.


{title:Description}

{pstd}
Class {it:classname} is defined in file {it:classname}{cmd:.class}.  Its
structure is

	{hline 40} {it:classname}{cmd:.class} {hline}
	{cmd:version} ...           // Part 1:  version statement

	{cmd:class} {it:classname} {cmd:{c -(}}     // Part 2:  declaration of member variables
		...
	{cmd:{c )-}}

	{cmd:program} ...           // Part 3:  code for member programs
		...
	{cmd:end}

	{cmd:program} ...
		...
	{cmd:end}

	...
	{hline 40} {it:classname}{cmd:.class} {hline}

{pstd}
See {help classman} for more information.


{title:Also see}

{psee}
Manual:  {bf:[P] class}{p_end}

{psee}
Online:  {help class}, {help classman};{break}
{help classassign}, {help classmacro}, {help classbi}
{p_end}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?