TLPP - LANGUAGE
Métodos estáticos são métodos que podem ser invocados sem a necessidade de instanciar um objeto da classe.
Por padrão, métodos estáticos são implicitamente públicos.
MetodoEstatico.tlpp
#include "protheus.ch" class StaticMethod public method new() static method staticExample() public method teste2() private 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
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas