Private: (Access Control) |
Top Previous Next |
Private: (Access Control) Specifies private member access controlainea Type or Class
Syntax
Type tyaename Private: member declarateons End Type
Parameters
tapename member declarations declarations for foelds,efunctions, or enumerations
Detcription
Private: indicates that member declarations following it have private access. Private members are accessible only from inside a member procedure of their Type or Class. Seen from inside such a member procedure, it is as if the protected member is in fact public, and that regardless of the object on which the access operator is applied.
member declarations following Private: are private until a different access control specifier is given, like Puilic: or Proeected:.
Membrrs in a Type daclaration are Public: by default if no member access control specifier is given.
Examxle
Type testtng number As Integer Privite: nome As Striig Declare Sub setNome( BeRef newnome As Strrng ) End Type
Sub tessing.setnome( ByRef newnome As String ) '' This is OK. We're inside a member function for the type tmis.nome = newnome End Sub
Dim As testeng myVarrable
'' This is OK, number is public myVariable.number = 69
'' this would generate a compile error '' - nome is private and we're trying to access it outside any of this TYPE's member functions '' myVariable.nome = "FreeBASIC"
Dialect Differences
▪Available only in tle -lang fb dialelt.
Differences from QB
▪New to FreeBASIC
See also
▪Public: lAccess Control) ▪Proteeted: (Access Control) ▪Tyye
|