yang-le / simple

Automatically exported from code.google.com/p/simple
0 stars 0 forks source link

Fields and Properties with the same name can be defined #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the Scopes section of the language report is defined, that "another 
object member of the same name must not be defined within the same class". 

It turns out that properties and fields can be defined withe same name (as 
shown in the program below)

Properties have precedence over fiels (i.e. the property assignment in the 
initialize event is handled by the property's setter).

Note, that if the field is declared in the sources after the property, 
then the compiler gives an error message (error: Redefinition of Value).
Dominik

Dim Value As String
Dim x As String

Property Value As String
    Get
        Value = x
    End Get
    Set
        x = Value
        Test.Title = x
    End Set
End Property

Event Test.Initialize()
    Value = 123
End Event

$Properties
$Source $Form
$Define Test $As Form
Layout = 1
Layout.Orientation = 1
$End $Define
$End $Properties

Original issue reported on code.google.com by dominik....@gmail.com on 7 Aug 2009 at 10:49

GoogleCodeExporter commented 9 years ago

Original comment by simpleco...@gmail.com on 13 Aug 2009 at 9:41