{{fbdoc item="title" value="This"}}----
Hidden instance parameter passed to non-static member functions in a ##[[KeyPgType|Type]]## or ##[[KeyPgClass|Class]]##

{{fbdoc item="syntax"}}##
	**this**.//fieldname//
//or//
	[[KeyPgWith|With]] **this**
		.//fieldname//
	End With
##
{{fbdoc item="desc"}}
	##**This**## is a reference to an instance of a ##[[KeyPgType|Type]]## or ##[[KeyPgClass|Class]]## that is passed (through a hidden ##[[KeyPgByref|Byref parameter]]##) to all non-static member functions of that type or class. Non-static member functions are procedures declared inside the body of a ##[[KeyPgType|Type]]## or ##[[KeyPgClass|Class]]## and include ##[[KeyPgMemberSub|Sub]]##, ##[[KeyPgMemberFunction|Function]]##, ##[[KeyPgConstructor|Constructor]]##, ##[[KeyPgDestructor|Destructor]]##, assignment or ##[[KeyPgOpCast|Cast]]## ##[[KeyPgOperator|Operator]]##, and ##[[KeyPgProperty|Property]]## procedures.
	
	The ##**This**## additional parameter also has the same data type as the ##[[KeyPgType|Type]]## or ##[[KeyPgClass|Class]]## in which the procedure is declared. Therefore using it corresponds to referring to the instance declared name on which the non-static member function is called.
	
	The ##**This**## parameter can be used just like any other variable, ie., pass it to procedures taking an object of the same type, call other member procedures and access member data using ##[[KeyPgOpMemberAccess|Operator . (Member access)]]##, etc.
	
	Most of the time, using ##**This**## explicitly for member access is unnecessary; member procedures can refer to other members of the instance which they are passed directly by name, without having to qualify it with ##**This**## and ##[[KeyPgOpMemberAccess|Operator . (Member access)]]##. The only times when you need to qualify member names with ##**This**## is when the member is shadowed, for example by duplicating its name for a local variable or parameter. In these situations, qualifying the member name is the only way to refer to these masked member names.

{{fbdoc item="ex"}}
	{{fbdoc item="filename" value="examples/manual/udt/this.bas"}}%%(freebasic)
TYPE sometype
	DECLARE SUB MyCall()
	value AS INTEGER
END TYPE

DIM example AS sometype

'' Set element test to 0
example.value = 0
print example.value

example.MyCall()

'' Output should now be 10
print example.value

END 0

SUB sometype.MyCall()
	This.value = 10
END SUB
%%
{{fbdoc item="diff"}}
	- New to ""FreeBASIC""

{{fbdoc item="see"}}
	- ##[[KeyPgBase|Base]]##
	- ##[[KeyPgClass|Class]]##
	- ##[[KeyPgType|Type]]##

{{fbdoc item="back" value="CatPgUserDefTypes|User Defined Types"}}