Home

TOTVS Technology

Child pages
  • Static Method

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Composition Setup
import.css=/download/attachments/327912/newLayout.css
Portuguese
Section

Scope 

Version 17.3.0.0 and later

Section

From version 17.3.0.0 static methods are available for TL++. 
Static methods are publics as default. 

Code Block
languagecpp
firstline1
titleMetodoEstatico.tlpp
linenumberstrue
#include "protheus.ch" 

class StaticMethod
	method new()
	static method staticExample()
	method teste2()
	data dataI
endclass 


method new() class ForWithProperty 

return self 

method staticExample() class StaticMethod
	conout("exemplo")
	/* conout(::dataI) //C9904 Cannot access data nor methods of class from a static method */
	/* conout(::teste2()) //C9904 Cannot access data nor methods of class from a static method */
return 

method teste2() class StaticMethod
return 

main function tteci_142
  StaticMethod():staticExample()
return 





#include "protheus.ch"

class StaticMethod
method new()
static method staticExample()
data dataI
endclass


method new() class ForWithProperty

return self


method staticExample() class StaticMethod
conout("oizinho")
return

main function tteci_142
StaticMethod():staticExample()
return