[ver]
	4
[sty]
	
[files]
[charset]
	82
	ANSI (Windows, IBM CP 1252)
[revisions]
	0
[sequence]
	58
	0
	0
	0
	12
	0
	Numbered List
	421
	bullet
	421
	indent bullet
	421
	Note
	421
	indent Note
	421
	tip
	421
	Caution
	421
	indentCaution
	421
	find
	0
	Footnote
	421
	indent Tip
	421
	indent Find
[prn]
	Apple LaserWriter II NTX
[port]
	LPT1:
[lang]
	1
[fldnames]
	Field1
	Field2
	Field3
	Field4
	Field5
	Field6
	Field7
	Field8
[desc]
	File ch05.rtf was converted from Rich Text Format on 4/7/94
	
	
	
	
	802475796
	59
	765722385
	494
	24
	0
	0
	0
	0
	
	
	
	
	
	
	1
[fopts]
	0
	1
	0
	0
	
	
[lnopts]
	2
	Body Text
	1
[docopts]
	5
	2
[GramStyle]
	
[ParaNum]
	1
[tag]
	Body Text
	2
	[fnt]
		Palatino
		200
		0
		49152
	[algn]
		1
		3
		720
		0
		0
	[spc]
		24
		200
		4
		120
		120
		4
		100
	[brk]
		36
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		0
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		280
		1
		2
		.
		,
		$
	1Body Text
	3
	1
	600
	1
	1200
	1
	3720
	0
[tag]
	Ahead
	3
	[fnt]
		Helvetica
		280
		0
		16385
	[algn]
		1
		1
		0
		0
		0
	[spc]
		40
		300
		4
		360
		120
		4
		100
	[brk]
		80
	[line]
		9
		0
		4
		0
		1
		1
		1
		110
		10
		1
	[spec]
		0
		2
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Body Text
	0
	0
[tag]
	Bhead
	4
	[fnt]
		Helvetica
		240
		0
		16385
	[algn]
		1
		3
		0
		0
		0
	[spc]
		40
		280
		4
		100
		90
		4
		100
	[brk]
		80
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		2
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Body Text
	0
	0
[tag]
	Chead
	5
	[fnt]
		Helvetica
		200
		0
		16385
	[algn]
		1
		3
		720
		0
		0
	[spc]
		40
		240
		4
		80
		0
		4
		100
	[brk]
		80
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		2
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Body Text
	0
	0
[tag]
	Numbered List
	6
	[fnt]
		Palatino
		200
		0
		49152
	[algn]
		1
		3
		744
		336
		336
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		0
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		3
		<*:>.
		0
		3
		1
		1
		2
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Numbered List
	0
	0
[tag]
	bullet
	7
	[fnt]
		Palatino
		200
		0
		49152
	[algn]
		1
		3
		720
		300
		300
	[spc]
		40
		240
		4
		80
		80
		4
		100
	[brk]
		0
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		<*1>
		0
		3
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	bulleted list
	0
	0
[tag]
	1st lev para
	8
	[fnt]
		Palatino
		200
		0
		49152
	[algn]
		1
		3
		1080
		0
		0
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	1st lev para
	0
	0
[tag]
	mono
	9
	[fnt]
		Courier
		180
		0
		32769
	[algn]
		1
		3
		720
		0
		0
	[spc]
		24
		220
		4
		120
		120
		4
		100
	[brk]
		36
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		280
		1
		2
		.
		,
		$
	mono
	22
	1
	864
	1
	1209
	1
	1555
	1
	1900
	1
	2246
	1
	2592
	1
	2937
	1
	3283
	1
	3628
	1
	3974
	1
	4320
	1
	4665
	1
	5011
	1
	5356
	1
	5702
	1
	6048
	1
	6393
	1
	6739
	1
	7084
	1
	7430
	1
	7776
	1
	8121
	0
[tag]
	indent bullet
	11
	[fnt]
		Palatino
		200
		0
		49152
	[algn]
		1
		3
		1104
		216
		216
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		0
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		<*1>
		0
		3
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	indent bullet
	0
	0
[tag]
	Note
	12
	[fnt]
		Helvetica
		200
		0
		16384
	[algn]
		1
		3
		720
		600
		0
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		0
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		Note
		0
		3
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Note
	0
	0
[tag]
	2nd lev para
	0
	[fnt]
		Palatino
		200
		0
		49152
	[algn]
		1
		3
		1320
		0
		0
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		1
		2
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	2nd lev para
	0
	0
[tag]
	Table Text
	0
	[fnt]
		Palatino
		180
		0
		49152
	[algn]
		1
		1
		0
		0
		0
	[spc]
		40
		200
		4
		79
		0
		3
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		0
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Table Text
	0
	0
[tag]
	Body Text1
	0
	[fnt]
		Palatino
		200
		0
		49152
	[algn]
		1
		3
		720
		0
		0
	[spc]
		40
		240
		4
		20
		40
		4
		100
	[brk]
		36
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		1
		
		18944
		1
		1
		0
		2
		0
		0
	[nfmt]
		280
		1
		2
		.
		,
		$
	Body Text1
	4
	1
	2390
	1
	2869
	1
	3347
	1
	3826
	0
[tag]
	indent Note
	0
	[fnt]
		Helvetica
		200
		0
		16384
	[algn]
		1
		3
		1080
		600
		0
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		0
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		Note
		0
		3
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	indent Note
	0
	0
[tag]
	tip
	0
	[fnt]
		Helvetica
		200
		0
		16384
	[algn]
		1
		3
		720
		480
		0
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		Tip
		0
		3
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	tip
	0
	0
[tag]
	Caution
	0
	[fnt]
		Helvetica
		200
		0
		16384
	[algn]
		1
		3
		720
		900
		0
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		Caution
		0
		3
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Caution
	0
	0
[tag]
	indentCaution
	0
	[fnt]
		Helvetica
		200
		0
		16384
	[algn]
		1
		3
		1080
		900
		0
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		Caution
		0
		3
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	indentCaution
	0
	0
[tag]
	Term
	0
	[fnt]
		Palatino
		200
		0
		49153
	[algn]
		1
		3
		720
		0
		0
	[spc]
		24
		240
		4
		0
		0
		4
		100
	[brk]
		80
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		2
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		280
		1
		2
		.
		,
		$
	Body Text
	0
	0
[tag]
	indent Term
	0
	[fnt]
		Palatino
		200
		0
		49153
	[algn]
		1
		3
		1080
		0
		0
	[spc]
		24
		240
		4
		0
		0
		4
		100
	[brk]
		16
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		2
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		280
		1
		2
		.
		,
		$
	indent Term
	0
	0
[tag]
	find
	0
	[fnt]
		Helvetica
		200
		0
		16384
	[algn]
		1
		3
		720
		1800
		0
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		Finding Out More
		0
		3
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	find
	0
	0
[tag]
	procdure Bhd
	0
	[fnt]
		Helvetica
		220
		0
		16385
	[algn]
		1
		3
		0
		0
		0
	[spc]
		40
		260
		4
		100
		90
		4
		100
	[brk]
		80
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		2
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Numbered List
	0
	0
[tag]
	procdure Chd
	0
	[fnt]
		Helvetica
		200
		0
		16385
	[algn]
		1
		3
		720
		0
		0
	[spc]
		40
		240
		4
		80
		80
		4
		100
	[brk]
		80
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		2
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Numbered List
	0
	0
[tag]
	formula
	0
	[fnt]
		Helvetica
		180
		0
		16384
	[algn]
		1
		3
		1080
		0
		0
	[spc]
		40
		220
		4
		0
		80
		4
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	formula
	0
	0
[tag]
	Table Title
	0
	[fnt]
		Helvetica
		180
		0
		16385
	[algn]
		1
		3
		720
		0
		0
	[spc]
		40
		220
		4
		40
		80
		4
		100
	[brk]
		16
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Table Title
	0
	0
[tag]
	Column Head
	0
	[fnt]
		Palatino
		180
		0
		49154
	[algn]
		1
		3
		0
		0
		0
	[spc]
		40
		220
		4
		0
		0
		3
		100
	[brk]
		4
	[line]
		11
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Column Head
	0
	0
[tag]
	call-out
	0
	[fnt]
		Helvetica
		160
		0
		16384
	[algn]
		1
		3
		0
		0
		0
	[spc]
		40
		180
		4
		0
		0
		1
		100
	[brk]
		0
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	call-out
	0
	0
[tag]
	chap number
	0
	[fnt]
		Helvetica
		720
		0
		16385
	[algn]
		1
		3
		0
		0
		0
	[spc]
		40
		520
		4
		0
		0
		4
		100
	[brk]
		0
	[line]
		17
		1680
		4
		0
		1
		1
		1
		420
		10
		1
	[spec]
		0
		2
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	chap number
	0
	0
[tag]
	Chapter Title
	0
	[fnt]
		Helvetica
		320
		0
		16385
	[algn]
		1
		3
		720
		0
		0
	[spc]
		40
		360
		4
		0
		480
		3
		100
	[brk]
		81
	[line]
		17
		8520
		3
		0
		1
		3
		1
		644
		10
		1
	[spec]
		0
		2
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Body Text
	0
	0
[tag]
	1st Pg Footer
	0
	[fnt]
		Palatino
		180
		0
		49153
	[algn]
		2
		3
		0
		0
		0
	[spc]
		33
		273
		1
		0
		0
		1
		100
	[brk]
		0
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	1st Pg Footer
	0
	0
[tag]
	right footer
	0
	[fnt]
		Palatino
		180
		0
		49153
	[algn]
		4
		1
		0
		0
		0
	[spc]
		33
		216
		1
		60
		0
		3
		100
	[brk]
		32
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	right footer
	1
	3
	8640
	0
[tag]
	left footer
	0
	[fnt]
		Palatino
		180
		0
		49153
	[algn]
		4
		1
		0
		0
		5212
	[spc]
		33
		216
		1
		60
		0
		3
		100
	[brk]
		32
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	left footer
	1
	3
	8640
	0
[tag]
	Footnote
	0
	[fnt]
		Times New Roman
		180
		0
		49152
	[algn]
		1
		3
		0
		244
		0
	[spc]
		40
		2400
		3
		0
		0
		1
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		0
		<*:>
		0
		1
		1
		256
		0
		0
		0
	[nfmt]
		280
		1
		2
		.
		,
		$
	Footnote
	0
	0
[tag]
	Figure Title
	0
	[fnt]
		Helvetica
		180
		0
		16385
	[algn]
		1
		3
		720
		0
		0
	[spc]
		40
		220
		4
		40
		80
		4
		100
	[brk]
		80
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	Body Text
	0
	0
[tag]
	indent Tip
	0
	[fnt]
		Helvetica
		200
		0
		16384
	[algn]
		1
		3
		1080
		480
		0
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		Tip
		18944
		3
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	indent tip
	0
	0
[tag]
	indent Find
	0
	[fnt]
		Helvetica
		200
		0
		16384
	[algn]
		1
		3
		1080
		1800
		0
	[spc]
		40
		240
		4
		0
		80
		4
		100
	[brk]
		4
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		4
		Finding Out More
		18944
		3
		1
		1
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	indent find
	0
	0
[tag]
	copyrt
	0
	[fnt]
		Palatino
		180
		0
		49152
	[algn]
		1
		3
		0
		0
		0
	[spc]
		24
		220
		4
		0
		60
		4
		100
	[brk]
		36
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		1
		
		18944
		1
		1
		0
		2
		0
		0
	[nfmt]
		280
		1
		2
		.
		,
		$
	copyrt
	4
	1
	2390
	1
	2869
	1
	3347
	1
	3826
	1200
[tag]
	seealso
	0
	[fnt]
		Helvetica
		200
		0
		16385
	[algn]
		1
		3
		720
		0
		0
	[spc]
		40
		240
		4
		80
		0
		4
		100
	[brk]
		16
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		2
		
		0
		1
		1
		0
		0
		0
		0
	[nfmt]
		272
		1
		2
		.
		,
		$
	seealso
	0
	0
[tag]
	crossref
	0
	[fnt]
		Palatino
		200
		0
		49152
	[algn]
		1
		3
		720
		0
		0
	[spc]
		40
		240
		4
		0
		0
		4
		100
	[brk]
		36
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		1
		
		18944
		1
		1
		0
		2
		0
		0
	[nfmt]
		280
		1
		2
		.
		,
		$
	crossref
	4
	1
	2390
	1
	2869
	1
	3347
	1
	3826
	0
[tag]
	popref
	0
	[fnt]
		Palatino
		200
		0
		49152
	[algn]
		513
		3
		720
		0
		720
	[spc]
		40
		240
		4
		0
		0
		4
		100
	[brk]
		36
	[line]
		8
		0
		1
		0
		1
		1
		1
		10
		10
		1
	[spec]
		0
		1
		
		18944
		1
		1
		0
		2
		0
		0
	[nfmt]
		280
		1
		2
		.
		,
		$
	popref
	4
	1
	2390
	1
	2869
	1
	3347
	1
	3826
	0
[lay]
	Standard
	3079
	[rght]
		12960
		10166
		1
		960
		1200
		3
		960
		720
		0
		1
		0
		1
		0
		2
		1
		960
		9446
		5
		1
		720
		1
		1440
		1
		2880
		1
		4320
		1
		5760
	[lft]
		12960
		10166
		1
		720
		1200
		3
		960
		960
		0
		1
		0
		1
		0
		2
		1
		720
		9206
		5
		1
		720
		1
		1440
		1
		2880
		1
		4320
		1
		5760
	[hlft]
	[lyfrm]
		1
		3008
		0
		0
		10166
		960
		0
		1
		3
		1 0 0 0 0 0 0
		0
		0
		1
	[frmlay]
		960
		10166
		1
		720
		180
		3
		480
		960
		0
		1
		0
		1
		1
		0
		1
		720
		9206
		0
	[txt]
@right footer@LotusScript Language Reference	10/03/94

>
	[hrght]
	[lyfrm]
		1
		11200
		0
		0
		10166
		960
		0
		1
		3
		1 0 0 0 0 0 0
		0
		0
		2
	[frmlay]
		960
		10166
		1
		960
		180
		3
		480
		720
		0
		1
		0
		1
		1
		0
		1
		960
		9446
		0
	[txt]
@right footer@10/03/94<:f>	LotusScript Language Reference

>
	[flft]
	[lyfrm]
		1
		5056
		0
		11760
		10166
		12960
		0
		1
		3
		1 0 0 0 0 0 0
		0
		0
		3
	[frmlay]
		12960
		10166
		1
		720
		480
		3
		11940
		960
		0
		1
		0
		1
		1
		0
		1
		720
		9206
		0
	[txt]
@right footer@page <:P10,0,>	Lotus Strictly Private

>
	[frght]
	[lyfrm]
		1
		13248
		0
		11760
		10166
		12960
		0
		1
		3
		1 0 0 0 0 0 0
		0
		0
		4
	[frmlay]
		12960
		10166
		1
		960
		480
		3
		11940
		720
		0
		1
		0
		1
		1
		0
		1
		960
		9446
		0
	[txt]
@right footer@Lotus Strictly Private	page <:P10,0,>

>
[elay]
[l1]
	0
[pg]
	5
	14 14 24 0 1 0 0 220 65535 Standard	65535 0 0	0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
	24 87 10 0 1 0 0 220 65535 Standard	65535 0 0	0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
	34 0 89 32 0 0 0 200 65535 Standard	65535 0 0	0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
	44 497 12 32 0 0 0 200 65535 Standard	65535 0 0	0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
	58 0 42 32 0 0 0 200 65535 Standard	65535 0 0	0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
[edoc]
@Chapter Title@<:#1364,8486><:f>Chapter 5  <**>Classes

@Ahead@<:#410,8486>Defining Classes and Their Members

@Bhead@<:#280,8486><:f><:f><:f><:f>Classes in LotusScript<:X8,1;Index "Classes" #><:X8,1;Index "Object-oriented programming" #><:X8,1;Index "Class members" #><:X8,1;Index "Class methods" #><:X8,1;Index "Class data" #><:X8,1;Index "Data in classes" #><:X8,1;Index "Methods" #>

@1st Paragraph@<:#1200,8486><:f>A fundamental user-defined data structure in LotusScript is a class. Classes are similar to types, but they go one step further. Like types, classes let you declare aggregates of data that can be manipulated as a single unit. But classes also allow you 
to declare subprograms that manipulate the class data. The data and the subprograms together form a class, a single unit. A programming language such as LotusScript that lets you create programs based on classes is called an object-oriented programming lang
uage.

<:#1200,8486><:f>You define a class very much the way you define a type: You define the variables that are aggregated in the class. You also define the subprograms that manipulate the class variables. Each variable and subprogram defined in a class is called a member of
 the class. The variables you define for the class are referred to as data members; the subprograms you define for the class are referred to as methods. Methods can take the form of subs, functions, or properties. 

<:#600,8486><:f>Once you define a class, you can create instances of that class, called objects. Objects can be assigned to variables; they can be created and deleted at runtime; and their methods can be invoked to compute results.

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>Defining Types

@popref@<:#240,8486><:f>Class...End Class Statement: to define a class

@Bhead@<:#280,8486><:f>Defining Classes<:X8,1;Index "Classes" #><:X8,1;Index "Class members" #>

@1st Paragraph@<:#600,8486><:f>You define classes using the Class...End Class statement. Within this statement you can define the data members and the methods of a class. Classes can only be defined at the module level.

<:#600,8486><:f>For example, in the following script, a Customer class is declared with member data Name, Address, and Balance. The Customer class also includes a member subprogram, the sub named CheckOverdue.

@Chead@<:#240,8486><:f>Example

@mono@<:#2420,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  Balance AS CURRENCY<**><**>  SUB CheckOverdue<**>    IF Balance <;> 0 THEN<**>      PRINT "Overdue balance"	'Print a message if balance is due<**>    END IF<**>  END SUB<**>END CLA
SS

@Bhead@<:#280,8486>Naming Classes and Class Members<:X8,2;Index "Class naming" #><:X8,2;Index "Class member naming" #>

@1st Paragraph@<:#800,8486><:f>Names of classes are in the same namespace as names of user-defined types. This namespace is different from the namespace for names of variables and subprograms. This means, for example, that while a type and a class can</R>t have the same name, a class
 and a variable can have the same name. 

<:#200,8486><:f>The names of properties can be LotusScript keywords, except for these keywords:

<:#1800,8486>Function<**>Get<**>Private<**>Property<**>Public<**>Rem<**>Set<**>Static<**>Sub

<:#400,8486>Methods can be named with any LotusScript keyword. For example, a member sub can be named Sub.

<:#400,8486>The New and Delete keywords can only be used in a class to name Subs. They cannot name any other class member, and they cannot name a class.

@Chead@<:#240,8486><:f>Example 1

@mono@<:#1100,8486>DIM Cant AS INTEGER<**>'The same name used for a variable and a class<**>CLASS Cant<**>  X AS INTEGER<**>END CLASS

@Chead@<:#240,8486><:f>Example 2

@mono@<:#880,8486>'The same name used for a class and a data member<**>CLASS Zold <**>  PUBLIC Zold AS INTEGER	<**>END CLASS

@mono@<:#660,8486>'Zold is used also for an object<**>DIM Zold AS NEW Zold	<**>PRINT Zold.Zold

@Chead@<:#240,8486><:f>Example 3

@mono@<:#2420,8486>'Keyword If used to name a variable (case is irrelevant)<**>CLASS MyClass<**>  PUBLIC If AS INTEGER<**>  SUB Dim				'Keyword Dim used to name a method<**>    PRINT "Dim member subprogram called"<**>  END SUB<**>END CLASS<**><**>DIM M AS NEW MyClass<**>PRINT
 M.If<**>CALL M.Dim

@Bhead@<:#280,8486><:f>Declaring Data Members<:X8,3;Index "Data in classes" #><:X8,3;Index "Class data" #>

@1st Paragraph@<:#400,8486><:f>In  the Customer class definition, a data member by the name of Name is declared to be of type String.

@Chead@<:#240,8486><:f>Example

@mono@<:#1320,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  Balance AS CURRENCY<**>  ...<**>END CLASS

<:#1000,8486><:f>A class member variable declaration has the same form as an ordinary variable declaration, except that the keyword Dim is omitted. The declaration begins either with the keyword Public or Private, or else with the name of the variable. A variable not de
clared as Public or Private is Private by default, like the member Balance declared in the example above. Class members can</R>t be declared as Static.

<:#1000,8486><:f>Only one data member can be declared per statement. Unlike type members, class data members are not restricted to scalar variables, user-defined type variables, and fixed arrays of scalar variables and user-defined type variables. They can be dynamic ar
ray variables or list variables. The variables can also be object reference variables, including object reference variables of the class being defined. 

<:#200,8486><:f>Class data members cannot be constants: the Const statement is illegal in class scope.

@Bhead@<:#280,8486><:f><:f>Defining Methods<:X8,4;Index "Methods" #><:X8,4;Index "Class methods" #>

@1st Paragraph@<:#400,8486><:f>You define class methods using the same syntax you use to define subprograms at the module level. 

<:#400,8486><:f>The CheckOverdue method in the class Customer in the example below is defined as a sub with no arguments. It refers to the Balance data member.

@Chead@<:#240,8486><:f>Example

@mono@<:#2420,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  Balance AS CURRENCY<**><**>  SUB CheckOverdue<**>    IF Balance <;> 0 THEN<**>      PRINT "Overdue balance"	'Print a message balance is due<**>    END IF<**>  END SUB<**>END CLASS

@Bhead@<:#280,8486>Visibility of Class Members<:X8,4;Index "Visibility" #><:X8,4;Index "PUBLIC" #><:X8,4;Index "PRIVATE" #>

@1st Paragraph@<:#400,8486>Public class members can be referenced outside the class definition; Private members cannot.

@Chead@<:R1,4,1,1200,1,1680,1,2160,1,4140,><:#240,8486><:f>Example

@mono@<:R><:#2420,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  Balance AS CURRENCY<**>  
<**>  SUB CheckOverdue<**>    IF Balance <;> 0 THEN<**>      PRINT "Overdue balance"	'Print a message if balance is due<**>    END IF<**>  END SUB<**>END CLASS

<:#1400,8486>The data member Balance is Private, the default when neither Private nor Public is specified in the variable declaration. The only subprograms that can refer to Balance data are member subprograms defined in the class Customer, like the member sub CheckOver
due defined above. This feature is often referred to as data hiding: Private member data is hidden from subprograms defined outside the class. Data hiding helps programmers to structure their programs more carefully, and to limit access to member data.

<:#600,8486><:f>Methods are Public by default. This means that typically, a class</R>s methods can be referred to outside the class definition. For example, the sub CheckOverdue in the example above is Public.

<:#600,8486>The programmer can change the default visibility of class data members and methods. In the example above, the data members Name and Address are declared Public. They can be referred to by subprograms defined outside the class.

@Ahead@<:#410,8486><:f><:f>Creating Objects and Managing Object References

@Bhead@<:#280,8486>Object Reference Variables<:X8,5;Index "Objects" #><:X8,5;Index "Object reference variables" #><:X8,5;Index "Class instances" #><:X8,5;Index "Instances of a class" #>

@1st Paragraph@<:#400,8486><:f>After declaring a class, you can use the Dim statement to declare variables that refer to objects of that class.

<:#400,8486>When you declare an object reference variable, an object itself is not created. The object reference variable is initialized to contain the special value NOTHING.

@Chead@<:#240,8486><:f>Example

@mono@<:#1540,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  ...<**>END CLASS<**><**>DIM X AS Customer	'Declare an object reference variable

<:#400,8486><:f>X can only hold references to Customer objects, or else the value NOTHING. It is initialized to NOTHING.

<:#400,8486><:f>The object reference variable can be an array or a list variable, as well as an ordinary variable.  Continuing from the above:

@mono@<:#440,8486>DIM Carr(10) AS Customer	'Array of objects<**>DIM CL LIST AS Customer		'List of objects

<:#800,8486><:f>Each element of the object reference variable Carr is initialized to NOTHING. A list has no elements when it is declared, so there is nothing to initialize in the object reference variable CL. Each element of Carr, and each element of CL when it is crea
ted, can hold either the value NOTHING or a reference to a Customer object.

@Bhead@<:#280,8486><:f>Creating Objects<:X8,5;Index "Objects" # "creating"><:X8,5;Index "NEW" #><:X8,5;Index "SET Statement" #><:X8,5;Index "Creating objects" #><:X8,5;Index "Object reference variables" #><:X8,5;Index "Class instances" #><:X8,5;Index "Instances of a class" #>
<:X8,5;Index "Creating objects" #>

@1st Paragraph@<:#200,8486><:f>There are two ways to create an object.

<:#800,8486><:f>The first is to use the keyword New in the declaration that declares an object reference variable. Besides declaring the object reference variable, the declaration including the keyword New creates an object, and assigns to the variable a reference to t
he newly-created object.

@Chead@<:#240,8486><:f>Example 1

@mono@<:#1100,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  ...<**>END CLASS

@mono@<:#880,8486>'Declare an object reference variable X of the class<**>'Customer, create an object of that class, and assign X<**>'a reference to the new Customer object.<**>DIM X AS NEW Customer

<:#400,8486><:f>The New keyword can</R>t be used in a declaration of an array object reference variable or a list object reference variable.

<:#600,8486>The second way to create an instance of a class is to use a Set statement that includes the New keyword and a variable that has previously been declared as an object reference variable for that class.

@Chead@<:#240,8486><:f>Example 2

@mono@<:#1100,8486><:f>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  ...<**>END CLASS

@mono@<:#660,8486>'Declare an object reference variable Y of the class<**>'Customer without creating an object. Y is initialized to NOTHING.<**>DIM Y AS Customer

@mono@<:#660,8486>'Create an object of the class Customer and<**>'assign Y a reference to that object.<**>SET Y = NEW Customer	

<:#400,8486>An array element or a list element can be assigned a reference to a newly-created object similarly. Continuing from the above:

@mono@<:#440,8486>'Declare an object reference variable Z<**>DIM Z(10) AS Customer

@mono@<:#440,8486>'Declare an object reference variable CL<**>DIM CL LIST AS Customer

@mono@<:#880,8486>'Create an object of the class Customer and assign <**>'Z(1) a reference to that object. The other elements of 
<**>'the array Z still contain the value NOTHING.<**>SET Z(1) = NEW Customer

@mono@<:#660,8486>'Create an object of the class Customer and assign a<**>'reference to that object to the list element 'CL("CUST01")<**>SET CL("CUST01") = NEW Customer

<:#800,8486>The Set statement is a kind of assignment statement used only to assign values to object reference variables. It can</R>t be used for assigning values to any other kind of variable. The common assignment statement, using the equals sign (<+!><:f,QCourier,>=
<-!><:f>) with or without the Let keyword, can</R>t be used to assign values to object reference variables.

<:#400,8486><:f>Note that an object reference variable doesn</R>t hold the object itself. It holds a reference to the object.

<:#1000,8486><:f>When an object is created, its data members are initialized, each to the initial value for the type of the member. For example, a data member of data type Integer is initialized to 0. If a data member is itself a user-defined type or a class, it is init
ialized by initializing its data members similarly. And so on. The lowest-level data members of the class being defined are variables with LotusScript built-in data types.

@Bhead@<:#280,8486><:f><:f>Assigning Object References<:X8,7;Index "Objects" #><:X8,7;Index "Object references" #><:X8,7;Index "Object reference variables" #><:X8,7;Index "Class instances" #><:X8,7;Index "Instances of a class" #><:X8,7;Index "SET Statement" #>

@1st Paragraph@<:#600,8486><:f>The preceding topic described how to use either a Dim statement including the New keyword, or a Set statement including the New keyword, to create an object and assign to a variable an object reference to the newly-created object.

<:#400,8486>A reference to an existing object can also be assigned, using the Set statement without the New keyword, as in the following example.

@Chead@<:#240,8486><:f>Example

@mono@<:#1100,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  ...<**>END CLASS

@mono@<:#880,8486>'Declare an object reference variable C, create an<**>'object of the class Customer, and assign C a reference<**>'to the new Customer object.<**>DIM C AS NEW CUSTOMER	

@mono@<:#660,8486>'Declare an object reference variable Carr(10).<**>'All elements of Carr are initialized to NOTHING.<**>DIM Carr(10) AS CUSTOMER

@mono@<:#660,8486><**>'Declare an object reference variable DTwo without<**>'creating an object. DTwo is initialized to NOTHING.<**>DIM DTwo AS CUSTOMER

@mono@<:#440,8486>'Assign the value in Carr(1), NOTHING, to DTwo.<**>SET DTwo = Carr(1)

@mono@<:#660,8486>'Assign to Carr(1) the same object reference contained in C.<**>'Carr(1) and C now refer to the same Customer object.<**>SET Carr(1) = C

@mono@<:#440,8486>'Now DTwo refers to the same Customer object as Carr(1) and C.<**>SET DTwo = Carr(1)

@mono@<:#660,8486>'The value NOTHING can be assigned to any object<**>'reference variable.<**>SET Carr(1) = NOTHING

@mono@<:#660,8486>'Create a new Customer object, and assign to Carr(1)'<**>'a reference to it.<**>SET Carr(1) = NEW Customer

@mono@<:#880,8486>'Create a new Customer object, and assign to DTwo a reference<**>'to it. Now the variables C, Carr(1), and DTwo each refer to<**>'a different Customer object.<**>SET DTwo = NEW Customer

<:#600,8486><:f>Note that an assignment using Set does not copy an object. The value being assigned is a reference to an object, not the object itself. Set copies the reference into the target variable.

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>Object Reference Variables

@popref@<:#240,8486><:f>Creating Objects

@Bhead@<:#280,8486><:f>Testing Object References (the IS Operator)<:X8,8;Index "Object references" #><:X8,8;Index "IS operator" #>

@1st Paragraph@<:#400,8486><:f>You can use the Is operator to test an object reference variable for the value NOTHING.

@Chead@<:#240,8486>Example 1

@mono@<:#2200,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  Balance AS CURRENCY<**>END CLASS<**><**>DIM X AS Customer<**>IF X IS NOTHING THEN  
	'Determine if X refers to an object<**>  PRINT "X is NOTHING"	'Prints "X is NOTHING"<**>END IF

<:#600,8486>You can also use the Is operator to compare two object reference variables. The Is operator returns TRUE (-1) if they refer to the same object, or if both have the value NOTHING. Otherwise it returns FALSE (0).

@Chead@<:#240,8486>Example 2

@mono@<:#1100,8486>DIM X AS NEW Customer, Y AS Customer<**>SET Y = X<**>IF X IS Y THEN PRINT "X is Y"		'Prints "X is Y" 
<**><**>DIM W AS Customer

@mono@<:#660,8486>'Prints "W is NOTHING", since W was initialized to NOTHING<**>IF W IS NOTHING THEN PRINT "W is NOTHING"	<**>SET W = NEW Customer

@mono@<:#660,8486><**>'Doesn't print, since now W holds a Customer object reference<**>IF W IS NOTHING THEN PRINT "W is NOTHING"	<**>SET W = NOTHING

@mono@<:#440,8486><**>'Prints "W is NOTHING"<**>IF W IS NOTHING THEN PRINT "W is NOTHING"	

<:#200,8486>You can use the Is operator in a control statement, for example a Do...Loop statement.

@Chead@<:#240,8486>Example 3

@mono@<:#1540,8486>DIM X AS NEW Customer, Y AS Customer<**>...<**>DO WHILE Y IS NOTHING		'The condition Y IS NOTHING<**>								'is either TRUE or FALSE<**>...<**>  SET Y = X<**>LOOP

@Chead@<:#240,8486>Related topics

@popref@<:#240,8486><:f>Is Operator

@Ahead@<:#410,8486><:f>Referring to Class Members

@Bhead@<:#280,8486>Referring to Data and Methods Using Dot Notation<:X8,10;Index "Class members" #><:X8,10;Index "Dot notation" #><:X8,10;Index ". (dot notation)" #><:X8,10;Index "Class" # "referring to members"><:X8,10;Index "Referring to class members" #><:X8,10;Index "Accessing class members" #>

@1st Paragraph@<:#600,8486><:f>Once an object is created, you can use </S>dot notation</T> to refer to the data and methods associated with the object. Dot notation is used to refer to an individual member of an object.

<:#1000,8486><:f>For objects declared outside the class, dot notation can only be used to access data members that are Public. For example, if X is a Public object reference variable of the class Customer, then the data member Balance in the class Customer is referred t
o as X.Balance outside the class definition. White space (space, tab, or newline) is legal on either side of the period (after X<+"> 
<-">and before Balance).

@Chead@<:#240,8486><:f>Example 1

@mono@<:#4840,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  PUBLIC Balance AS CURRENCY<**><**>  SUB CheckOverdue<**>    IF Balance <;> 0 THEN<**>      PRINT "Overdue balance"	'Send an overdue letter<**>    END IF<**>  END SUB         
<**>END CLASS<**><**>DIM X AS NEW Customer<**>'This is a legal statement, because Name is PUBLIC.<**>X.Name = "Acme Corporation"<**>X.Balance = 14.92				'Balance is PUBLIC.<**><**>DIM B AS CURRENCY<**>'Assigns the value of the PUBLIC data member Balance<**>
'to the variable B<**>B = X.Balance	<**>PRINT X.Balance; B				'Prints 14.92  14.92

<:#800,8486>Use the value of a class member as you would any other data of that type. For example, the value of X.Balance can be used like any other Currency data. The LotusScript rules for data type conversion apply to data in data members of classes no differently th
an to data in other variables.

<:#600,8486><:f>Like member data, member subprograms are referenced using dot notation. For example, to check for an overdue balance, you can invoke the sub CheckOverdue, as in the following example continuing from Example 1.

@Chead@<:#240,8486><:f>Example 2

@mono@<:#880,8486>DIM Y AS Customer<**>SET Y = X<**>Y.CheckOverdue	'Prints "Overdue balance"<**>PRINT Y.Balance; X.Balance	'Prints 14.92  14.92

<:#400,8486>Note that CheckOverdue as defined in the Class definition of Customer is Public by default. So it can be invoked outside the class even though it was not declared Public.

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>Accessing Overridden Methods (Using Dotdot Notation)

@Bhead@<:#280,8486><:f>Referring to Members of the Current Object Using ME<:X8,11;Index "Object references" #><:X8,11;Index "ME" #><:X8,11;Index "Class members" #><:X8,11;Index "Dot notation" #><:X8,11;Index ". (dot notation)" #><:X8,11;Index "Referring to object members" #>

@1st Paragraph@<:#200,8486><:f>The keyword Me is used within a method as a name for </S>the current object</T>.

<:#1000,8486>Within a class definition, Me is necessary to reference member names that are keywords. Also, if a method contains a local variable X, and X is also the name of a class member, you use Me.X within the method to refer to the member variable X. 
<**>You can also use Me in a class method to pass the current object as an argument to a subprogram.

<:#200,8486>Me is not valid outside of a class method.

@Chead@<:#240,8486><:f>Example

@mono@<:#2640,8486>CLASS UClass<**>  'Keyword Random is used as name of a data member<**>  Random AS INTEGER<**> 
<**>  SUB PrintMember<**>  'ME is required here, to refer to the member named Random<**>    PRINT ME.Random<**>  END SUB<**>END CLASS<**><**>DIM MP AS NEW UClass<**>CALL MP.PrintMember

@Ahead@<:#410,8486><:f>Object Management

@Bhead@<:#280,8486>Defining a Class Constructor (Sub New)<:X8,11;Index "Class constructor" #><:X8,11;Index "Constructor sub" #><:X8,11;Index "NEW" #><:X8,11;Index "SUB NEW" #><:X8,11;Index "Creating objects" #><:X8,11;Index "Objects" # "creating">

@1st Paragraph@<:#800,8486><:f>It is often useful to specify a sub to be executed automatically when an object is created. Within each class, you can define a special sub named New that will execute automatically when a new object of that class is created. This special sub is called 
a constructor. Sub New is always Public; it can</R>t be declared as Private. 

<:#800,8486>The example below defines a constructor for the class Customer. When a Dim or a Set statement with the New keyword is executed for the Customer class, the constructor will be called. The arguments to the Sub New are specified at the end of the Dim or Set st
atement.

<:#200,8486>The constructor in this example initializes the member data of the Customer object.

@Chead@<:R1,4,1,1200,1,1680,1,2160,1,7020,><:#240,8486><:f>Example

@mono@<:R><:#3960,8486>CLASS Customer<**>	PUBLIC Name AS STRING<**>	PUBLIC Address AS STRING<**>	PUBLIC Balance AS CURRENCY<**><**>	'Constructor sub<**>	SUB NEW (Na AS STRING, Addr AS STRING, Bal AS CURRENCY)<**>		ME.Name = Na<**>		ME.Address = Addr<**>		ME.Balance = Bal<**>	END 
SUB<**>END CLASS<**><**>DIM X AS NEW Customer ("Acme Corporation", _<**>	"55 Smith Avenue, Cambridge, MA", 14.92)<**><**>'Prints "Acme Corporation    55 Smith Avenue, Cambridge, MA   14.92"<**>PRINT X.Name; X.Address; X.Balance 

<:#1200,8486>At the end of the Dim statement that creates a new Customer object is the list of three arguments to the associated call of the Sub New for the Customer object. The arguments are two strings and a numeric value, matching the declared argument list of the Su
b New: two String arguments and a Currency argument. The effect of the Sub New is evidently to assign the values of its three arguments to the three data members of the newly-created object: Name, Address, and Balance respectively.

<:#400,8486>You can only invoke Sub New through a Dim statement or a Set statement, in the form described and illustrated above. Sub New can</R>t be called directly.

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>Defining a Class Destructor (Sub Delete)

@Bhead@<:#280,8486><:f>Deleting Objects<:X8,12;Index "Objects" #><:X8,12;Index "DELETE Statement" #><:X8,12;Index "Deleting objects" #><:X8,12;Index "Objects" # "deleting">

@1st Paragraph@<:#600,8486><:f>You can delete an object with the Delete statement. When you delete an object, all object reference variables that refer to that object are automatically assigned the value NOTHING. You can no longer refer to the object</R>s members.

@Chead@<:#240,8486><:f>Example

@mono@<:#3960,8486><:f>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  PUBLIC Balance AS CURRENCY<**>  ...<**>END CLASS<**><**>DIM X AS NEW Customer, Y AS Customer<**>PRINT X.Balance<**>SET Y = X<**><**>DELETE X<**>IF X IS NOTHING THEN PRINT "X is
 NOTHING"	'Prints "X is NOTHING"<**><**>'Runtime error. X doesn't refer to any object.<**>PRINT X.Balance<**><**>IF Y IS NOTHING THEN PRINT "Y is NOTHING"	'Prints "Y is NOTHING"

@mono@<:#440,8486>'Runtime error. Y doesn't refer to any object.<**>PRINT Y.Balance

<:#800,8486>Note carefully that the statement Delete X resulted in both the object reference variables X and Y being set to NOTHING, because Y referred to the same object as X.  Delete X means 
</S>delete the object referred to by X.</T> When this object is deleted, the reference in Y becomes invalid, so Y is set to NOTHING.

<:#600,8486>The Delete statement is your explicit way to delete an object. An object can also be deleted automatically by LotusScript. This happens when the reference count for the object is reduced to 0.

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>Managing Memory for Objects

@Bhead@<:#280,8486><:f>Defining a Class Destructor (Sub Delete)<:X8,13;Index "Class destructor" #><:X8,13;Index "Destructor sub" #><:X8,13;Index "DELETE" #><:X8,13;Index "SUB DELETE" #><:X8,13;Index "Deleting objects" #><:X8,13;Index "Objects" # "deleting">

@1st Paragraph@<:#800,8486><:f>Within each class, you can define a special sub named Delete that will execute automatically when an object of that class is deleted. This special sub is called a destructor. Sub Delete is always Public; it can't be declared as Private. Unlike a constru
ctor, a destructor can</R>t take any arguments.

<:#200,8486>Sub Delete can</R>t be called directly. It is invoked only when the instance is deleted.<:f,QCourier,> 
<:f>

@Chead@<:#240,8486><:f>Example

@mono@<:#4400,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  PUBLIC Balance AS CURRENCY<**><**>  'Constructor sub<**>  SUB NEW (Na AS STRING, Addr AS STRING, Bal AS CURRENCY)<**>    ME.Name = Na<**>    ME.Address = Addr<**>    ME.Balance = B
al<**>  END SUB<**><**>  SUB DELETE<**>    PRINT "Deleting Customer record for: "; ME.Name<**>  END SUB<**>END CLASS<**><**>DIM X AS NEW Customer ("Acme Corporation", _<**>  "55 Smith Avenue, Cambridge, MA", 14.92) 
<**>PRINT X.Balance		'Prints 14.92

@mono@<:#880,8486>'Calls SUB DELETE, which prints <**>'"Deleting Customer record for: Acme Corporation."<**>'Then the object is deleted.<**>DELETE X

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f><:f>Defining a Class Constructor (SUB NEW)

@Bhead@<:#280,8486><:f>Managing Memory for Objects<:X8,14;Index "Reference counting" #><:X8,14;Index "Object memory" #>

@1st Paragraph@<:#600,8486><:f>LotusScript automatically manages the memory associated with the objects you create. It does this by using a reference count to keep track of the number of variables that refer to an object.

<:#800,8486>The reference count is automatically set to 1 when you create an object, using either a Dim statement with New or a Set statement with New. This is because the Dim or Set statement with New assigns a reference to the object to an object reference variable o
f the class.

<:#400,8486>LotusScript automatically increments the reference count by 1 whenever you explicitly assign an object reference for that object to a variable.

<:#600,8486><:f>Similarly, when an object reference variable no longer refers to the instance, the reference count for the object is decremented by 1. For example, when an object reference variable goes out of scope, the reference count for its object is decremented.

<:#400,8486>When the reference count goes to 0, LotusScript deletes the object and frees its memory. Then you can no longer access the object.

@Chead@<:#240,8486><:f>Example 1

@mono@<:#1980,8486>CLASS Customer<**>  PUBLIC Name AS STRING<**>  PUBLIC Address AS STRING<**>  PUBLIC Balance AS CURRENCY<**>  ...<**>  SUB DELETE<**>    PRINT "Deleting Customer record for: "; ME.Name<**>  END SUB<**>END CLASS

@mono@<:#1100,8486>'Acme Corporation reference count is set to 1<**>DIM X AS NEW Customer ("Acme Corporation", _<**>  "55 Smith Avenue, Cambridge, MA", 14.92)<**><**>DIM Y AS Customer

@mono@<:#440,8486>'Acme Corporation reference count is 2<**>SET Y = X	

@mono@<:#660,8486>'Y no longer refers to Acme Corporation;<**>'Reference count goes to 1.<**>SET Y = NOTHING

@mono@<:#880,8486>'Reference count goes to 0.<**>'SUB DELETE for the object is called.<**>'The object is deleted and its memory is freed.<**>SET X = NOTHING

<:#1200,8486><:f>In Example 1, the object is deleted because its reference count goes to 0. An object is deleted also when you explicitly request deletion, using the Delete statement. In this case, LotusScript will delete the object even if one or more other variables h
old a reference to the object. All of these variables will be set to NOTHING when the object is deleted. Example 2 illustrates this, using the same Customer class definition as in Example 1.

@Chead@<:#240,8486><:f>Example 2

@mono@<:#880,8486>'Acme Corporation reference count is set to 1<**>DIM Z AS NEW Customer ("Acme Corporation", _<**>  "55 Smith Avenue, Cambridge, MA", 14.92)<**>DIM W AS Customer

@mono@<:#440,8486>'Acme Corporation reference count is 2<**>SET W = Z 

@mono@<:#880,8486>'SUB DELETE for the Acme Corporation object <**>'is called and the object is deleted.<**>'W and Z are both set to NOTHING.<**>DELETE W 

@mono@<:#880,8486><**>IF W IS NOTHING THEN PRINT "W is NOTHING"<**>							'Prints "W is NOTHING"<**>IF Z IS NOTHING THEN PRINT "Z is NOTHING"<**>							'Prints "Z is NOTHING"

@Ahead@<:#410,8486><:f><:f>Inheritance 

@Bhead@<:#280,8486>Derived Classes<:X8,16;Index "Derived classes" #><:X8,16;Index "Inheritance in classes" #><:X8,16;Index "Base classes" #>

@1st Paragraph@<:#1400,8486><:f>Inheritance is a basic concept in object-oriented programming. Inheritance allows you to define a new class, called the derived class, using an already defined class, called the base class. The derived class shares the base class members. A derived clas
s can be thought of as containing a hidden reference to the members of the base class. Inheritance also allows you to modify the behavior of the base class methods; this is usually called method overriding. You can also add new data members and methods in t
he derived class.

<:#200,8486><:f>The pseudo-code below shows the form of a derived class definition:

@mono@<:#1540,8486>CLASS C0			'C0 is the base class<**>  ... <**>END CLASS<**><**>CLASS C1 AS C0 
	'C1 is derived from C0<**>  ...<**>END CLASS

<:#400,8486><:f>The phrase AS C0 in the Class...End Class definition of C1 specifies that C1 is a derived class of C0.

<:#200,8486>The following example defines a class of graphic objects.

@Chead@<:#240,8486><:f>Example

@mono@<:#3960,8486>CLASS Shape<**>  PUBLIC Name AS STRING  	'The base class Shape has only Name as a<**>									'member<**>END CLASS<**><**>CLASS ColorShape AS Shape	'Define a class ColorShape derived from<**>									'Shape<**>  PUBLIC Color AS STRING	'Add Color as a member
 of ColorShape<**>END CLASS<**><**>DIM X AS NEW Shape<**>X.Name = "Shape1"			'Assign a value to the Name member<**>									'for the Shape object held by X<**><**>DIM Y AS NEW ColorShape<**>Y.Name = "Shape2"			'ColorShape has a Name member, inherited<**>			
						'from Shape<**>Y.Color = "Red"

@Bhead@<:#280,8486><:f>Executing Constructor and Destructor Subs Under Inheritance<:X8,17;Index "Class constructor" #><:X8,17;Index "Constructor sub" #><:X8,17;Index "SUB NEW" #><:X8,17;Index "Class destructor" #><:X8,17;Index "Destructor sub" #><:X8,17;Index "SUB DELETE" #>

@1st Paragraph@<:#600,8486><:f>When an object of a derived class is created, the Sub New of every class higher in the derivation chain is called, one after the other beginning at the highest class, in order. The Sub New of the class of the object being created is executed last.

<:#600,8486>When an object of a derived class is deleted, its Sub Delete is called, followed by its base class</R>s Sub Delete, and so on through every class in the derivation chain, to the highest base class. (The destructors are called in reverse order from the const
ructors.)

<:#400,8486><:f>The following example shows the order in which constructors and destructors are called. 

@Chead@<:#240,8486><:f>Example

@mono@<:#12540,8486>CLASS Shape<**>  PUBLIC Name AS STRING<**><**>  SUB NEW<**>    PRINT "In Shape's NEW"<**>  END SUB<**><**>  SUB DELETE<**>    PRINT "In Shape's DELETE"<**>  END SUB<**>END CLASS<**>CLASS ShapeA AS Shape		'Define a class ShapeA derived from class<**>								
	'Shape<**>  PUBLIC Arg1 AS STRING<**><**>  SUB NEW<**>    PRINT "In ShapeA's NEW"<**>  END SUB<**><**>  SUB DELETE<**>    PRINT "In ShapeA's DELETE"<**>  END SUB<**>END CLASS<**><**>CLASS ShapeB AS ShapeA	'Define a class ShapeB derived from class<**>						
'ShapeA<**>  PUBLIC Arg2 AS STRING<**><**>  SUB NEW<**>    PRINT "In ShapeB's NEW"<**>  END SUB<**><**>  SUB DELETE<**>    PRINT "In ShapeB's DELETE"<**>  END SUB<**>END CLASS<**><**>DIM X AS NEW Shape	'Creates a Shape object.<**>							'Invokes the SUB NEW
 of the Shape class;<**>							'Prints "In Shape's NEW"<**><**>DIM Y AS NEW ShapeA	'Creates a ShapeA object.<**>							'Prints "In Shape's NEW",<**>							'followed by "In ShapeA's NEW"<**><**>DIM Z AS NEW ShapeB	'Prints "In Shape's NEW",<**>							'followe
d by "In ShapeA's NEW",<**>							'followed by "In ShapeB's NEW"<**><**>DELETE X				'Prints "In Shape's DELETE"<**><**>DELETE Y				'Prints "In ShapeA's DELETE",<**>							'followed by "In Shape's DELETE"<**><**>DELETE Z				'Prints "In ShapeB's DELETE",<**>	
						'followed by "In ShapeA's DELETE",<**>							'followed by "In Shape's DELETE"

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>Defining a Class Constructor (Sub New)

@popref@<:#240,8486>Defining a Class Destructor (Sub Delete)

@Bhead@<:#280,8486><:f>Extending the Constructor for a Derived Class<:X8,18;Index "Derived classes" #><:X8,18;Index "Base classes" #>

@1st Paragraph@<:#400,8486><:f>You can define the constructor for a derived class to augment the definition of its base class</R>s constructor.

<:#200,8486>The general form of the Sub New definition for a derived class is:

@mono@<:#440,8486>SUB NEW (<+">arg_1<-"> AS <+">type_1<-">, <+">arg_2<-"> AS <+">type_2, ...<-">), 
<+">base_class <-">(<+">arg_a<-">, <+">arg_b,...<-">)

<:#200,8486><:f>The first parenthesized list is the argument list for the derived class</R>s Sub New.

<:#1000,8486>The second parenthesized list is the list of arguments to pass to the base class</R>s Sub New when it is called automatically before the call to the derived class</R>s Sub New. This is a list of actual arguments, not a list of argument declarations. This se
cond list can be omitted if the arguments for the derived class and base class constructors are the same.

<:#800,8486>The argument list for the call to the base class</R>s Sub New can be a subset of the argument list for the Sub New of the derived class. You can pass any expression, including a constant or a module-level variable, as an argument to the base class</R>s Sub 
New.

@Chead@<:#240,8486><:f>Example

@mono@<:#4620,8486>CLASS Shape<**>  PUBLIC ShapeName AS STRING<**>  <**>  SUB NEW (Nm AS STRING)<**>    ShapeName = Nm<**>  END SUB<**>END CLASS<**><**>CLASS ColorShape AS Shape	<**>  PUBLIC Color AS STRING<**><**>  SUB NEW (Clr AS STRING, Nam AS STRING), Shape(Nam)<**>   
				'Clr and Nam are the arguments of the derived class NEW.<**>   
				'Nam is passed to the base class NEW.<**>    Color = Clr<**>  END SUB<**>END CLASS<**><**>DIM X AS NEW ColorShape("Red", "Shape1")<**>PRINT X.Color		 
	'Prints "Red"<**>PRINT X.ShapeName	'Prints "Shape1"

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>Defining a Class Constructor (Sub New)

@popref@<:#240,8486>Executing Constructor and Destructor Subs Under Inheritance

@Bhead@<:#280,8486><:f>Overriding Methods<:X8,19;Index "Methods in classes" #><:X8,19;Index "Overriding methods" #>

@1st Paragraph@<:#1200,8486><:f>A method defined in a base class is accessible in the derived class. However, a frequently useful technique in object-oriented programming is to specialize the method in the derived class. This is called method overriding. There can be many reasons to d
o this: for example, the derived class can have additional members that require initialization; or the overriding method can change the calculation, or build on a previous one.  

<:#600,8486><:f>To override a method, you redefine the Sub, Property, or Function in the derived class. The arguments to the method in the derived class must match exactly the arguments in the class where the method was originally defined.

@Chead@<:#240,8486><:f>Example

@mono@<:#3520,8486>CLASS Shape<**>  SUB Display<**>    PRINT "In Shape's Display"<**>  END SUB<**>END CLASS<**><**>CLASS ShapeA AS Shape	'Class ShapeA is derived from class Shape<**>  SUB Display				'Override the base class Display method<**>    PRINT "In ShapeA's Display"<**>
  END SUB<**>END CLASS<**><**>DIM X AS NEW Shape<**>DIM Y AS NEW ShapeA<**>CALL X.Display		'Calls Shape's Display<**>CALL Y.Display		'Calls ShapeA's Display

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>References to a Base Class Variable Holding a Derived Class Object

@Bhead@<:#280,8486><:f>Accessing Overridden Methods (Using Dotdot Notation)<:X8,20;Index "Methods in classes" #><:X8,20;Index "Overriding methods" #><:X8,20;Index "Dotdot notation" #><:X8,20;Index ".. (dotdot notation)" #><:f><:X8,20;Index "Accessing overridden methods" #><:f,,>
<:X8,20;Index "Referring to overridden methods" #>

@1st Paragraph@<:#600,8486><:f>Within a class, you can call a method in a base class, even if that method has been overridden in the derived class. You refer to a base class</R>s overridden method with 
</S>dotdot notation</T>, in this form: 

<:#200,8486><+"><:f>base_class<+!><-">..<-!><+">method <-">(<+">arguments<-">)

<:#600,8486><:f>The dotdot notation uses a base class name, and a method and its arguments, to call the specified method. The dotdot notation can only be used in class scope (within a Class...End Class definition).

@Chead@<:#240,8486><:f>Example

@mono@<:#5060,8486>CLASS Shape<**>  SUB Display<**>    PRINT "In Shape's Display"<**>  END SUB<**>END CLASS<**><**>CLASS ShapeA AS Shape<**>  SUB Display<**>    PRINT "In ShapeA's Display"<**>  END SUB<**><**>  SUB DisplayBASE<**>    CALL Shape..Display	'Calls Shape's Display
 method<**>  END SUB<**><**>  SUB DisplayME<**>    Display				'Calls ShapeA's Display method<**>  END SUB<**>END CLASS<**><**>DIM X AS NEW ShapeA<**>X.DisplayBASE				'Prints "In Shape's Display"<**>X.DisplayME				'Prints "In ShapeA's Display"

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>Referring to Data and Methods Using Dot Notation

@popref@<:#240,8486>References to a Base Class Variable Holding a Derived Class Object

@Bhead@<:#280,8486><:f>Assignments Between Variables of a Base Class and a Derived Class<:X8,21;Index "Objects" #><:X8,21;Index "Derived classes" #>

@1st Paragraph@<:#200,8486><:f>The following two simple rules are established to enforce clarity in scripts.

<:#600,8486><:f>You can assign the contents of a variable of a derived class to a variable of a base class of the derived class. For example, a variable of class ShapeA can be assigned to a variable of class Shape if class ShapeA is derived from class Shape. 

<:#1000,8486>However, a reference in a variable of a base class cannot be assigned to a variable of a derived class. For example, a reference in a variable of class Shape cannot be assigned to a variable of class ShapeA. If such an assignment were allowed, you might exp
ect to be able to use ShapeA</R>s methods on the object referred to. But they might not exist, since the object might be of class Shape. 

@Chead@<:#240,8486><:f>Example

@mono@<:#2420,8486>CLASS Shape<**>  ...<**>END CLASS<**><**>CLASS ShapeA AS Shape<**>  ...<**>END CLASS<**><**>DIM X AS NEW Shape<**>DIM Y AS NEW Shape<**>DIM Z AS NEW ShapeA

@mono@<:#660,8486>'Legal asssignment of base class variable<**>'to base class variable<**>SET X = Y

@mono@<:#660,8486>'Legal assignment of derived class variable<**>'to base class variable<**>SET X = Z

@mono@<:#660,8486>'Illegal attempt to assign base class variable<**>'to derived class variable<**>SET Z = X

<:#800,8486>Note exactly what is illegal in the last statement in this example. After the preceding statement, SET X = Z, the variable X in fact contains a reference to an object of the derived class Z. But the statement SET Z = X attempts to assign the contents of a b
ase class variable, X, to a derived class variable, Z. This is illegal.

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>Assigning Object References

@Bhead@<:#280,8486><:f>References to a Base Class Variable Holding a Derived Class Object<:X8,22;Index "Objects" #><:X8,22;Index "Derived classes" #>

@1st Paragraph@<:#800,8486><:f>Suppose that an object of a derived class has been assigned to a variable of the base class, and a method of the base class is overridden by a method of the derived class. Then an invocation of that method on the object in that variable invokes the over
riding method, not the overridden method.

@Chead@<:#240,8486><:f>Example

@mono@<:#1540,8486>'Shape is the base class<**>CLASS Shape	<**>  'A Display method is defined in Shape<**>  SUB Display<**>    PRINT "In Shape's Display"<**>  END SUB<**>END CLASS

@mono@<:#1540,8486>'ShapeA is the derived class<**>CLASS ShapeA AS Shape	<**>  'Display method in ShapeA overrides the one in Shape<**>  SUB Display<**>    PRINT "In ShapeA's Display"<**>  END SUB<**>END CLASS

@mono@<:#440,8486>'Object reference variable of the base class Shape<**>DIM X AS NEW Shape

@mono@<:#440,8486>'Object reference variable of the derived class ShapeA<**>DIM Y AS NEW ShapeA

@mono@<:#880,8486>'Calls Shape's Display method<**>CALL X.Display<**>'X now holds a reference to an object of class ShapeA<**>SET X = Y

@mono@<:#440,8486>'Calls ShapeA's Display method, not Shape's Display method<**>CALL X.Display

@Chead@<:#240,8486><:f>Related topics

@popref@<:#240,8486><:f>Overriding Methods

@Bhead@<:#280,8486><:f>Objects as Arguments and Return Values<:X8,23;Index "Objects" #><:X8,23;Index "Objects as arguments" #>

@1st Paragraph@<:#400,8486><:f>You can  pass an object as an argument to a method, or to any subprogram defined to accept it. You can also use an object as the return value of a function or a property.

<:#200,8486><:f>An object is passed by reference; its values are not copied.

<:#400,8486>The same rules that govern assigning an object to a variable govern passing an object to a subprogram:

@bullet@<:#480,8486>A variable of a derived class can be passed to a subprogram when the subprogram argument is declared as a variable of the base class

@bullet@<:#480,8486>A variable of the base class cannot be passed when the subprogram</R>s argument is declared as a variable of the derived class

@Chead@<:#240,8486><:f>Example

@mono@<:#2420,8486>CLASS Shape<**>  SUB Display (Title AS STRING) <**>    PRINT "In Shape's Display"<**>  END SUB<**>END CLASS<**><**>CLASS ShapeA AS Shape<**>  SUB Display<**>    PRINT "In ShapeA's Display"<**>  END SUB<**>END CLASS

@mono@<:#2200,8486>'This sub is defined at module level. It takes an<**>'argument of class Shape.<**>SUB PrintShape(ShapeArg AS Shape)<**>  CALL ShapeArg.Display<**>END SUB<**><**>DIM X AS NEW Shape<**>CALL PrintShape(X)		'Calls Shape's Display method<**><**>DIM Y AS NEW Shap
eA

@mono@<:#660,8486>'Calls ShapeA's Display method. Y is legal as an argument to<**>'PrintShape, because ShapeA is a derived class of Shape.<**>CALL PrintShape(Y)

@Chead@<:#240,8486>Related topics

@popref@<:#240,8486><:f>Assigning Object References<:f>

>

[Embedded]
00061282
