Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
20
Task/Null-object/FreeBASIC/null-object.basic
Normal file
20
Task/Null-object/FreeBASIC/null-object.basic
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
'FB 1.05.0 Win64
|
||||
|
||||
' FreeBASIC does not have a NULL keyword but it's possible to create one using a macro
|
||||
|
||||
#Define NULL CPtr(Any Ptr, 0) '' Any Ptr is implicitly convertible to pointers of other types
|
||||
|
||||
Type Dog
|
||||
name As String
|
||||
age As Integer
|
||||
End Type
|
||||
|
||||
Dim d As Dog Ptr = New Dog
|
||||
d->Name = "Rover"
|
||||
d->Age = 5
|
||||
Print d->Name, d->Age
|
||||
Delete d
|
||||
d = NULL '' guard against 'd' being used accidentally in future
|
||||
|
||||
' in practice many FB developers would simply have written: d = 0 above
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue