Code: Select all
type a
as integer b,c
end type
dim as a a
a.b = 10
a.c = 20
dim as a ptr ap = @a
?ap->b
?ap->c
ap->b = 30
ap->c = 40
?a.b
?a.c
sleep
Thanks.
Code: Select all
type a
as integer b,c
end type
dim as a a
a.b = 10
a.c = 20
dim as a ptr ap = @a
?ap->b
?ap->c
ap->b = 30
ap->c = 40
?a.b
?a.c
sleep
sancho3 wrote:Do you think there should be a warning?
It seems to me that it is a feature of the compiler to be able to correctly distinguish between the two.
Everything works as expected in your sample code and there could be no way that you meant for the code to do anything else.
Also if I remember correctly C# allows this, and Python as well.
fxm wrote:This is allowed as long as the UDT does not have a member procedure or member field initializer, but I do not recommend declaring two different entities with the same name.
nimdays wrote:
Thanks, I'll use different name next time.
Code: Select all
type A
as integer _a
end type
dim a as A
a._a => 9
Code: Select all
dim as A ptr aPtr
Users browsing this forum: No registered users and 1 guest