Goals(1) = New Tile()
#1
Code: (Select All)
    ReDim Goals(6)
    Goals(1) = New Tile()
    Goals(1).Symbol = "o"
Expected operator in equation

Help.

thank you.
Reply
#2
(08-31-2023, 05:42 PM)gaslouk Wrote:
Code: (Select All)
    ReDim Goals(6)
    Goals(1) = New Tile()
    Goals(1).Symbol = "o"
Expected operator in equation

Help.

thank you.
What is "New Tile()"? If that's meant to be a function or UDT the space is not allowed.
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply
#3
(08-31-2023, 05:42 PM)gaslouk Wrote:
Code: (Select All)
    Goals(1) = New Tile()

QB64 doesn't have "new" operator, it doesn't support object-oriented programming. Yet.
Reply
#4
(08-31-2023, 05:42 PM)gaslouk Wrote:
Code: (Select All)
    ReDim Goals(6)
    Goals(1) = New Tile()
    Goals(1).Symbol = "o"
Expected operator in equation

Help.

thank you.

As mentioned "new" is an operator for object oriented programming languages such as C++, PHP, Javascript etc. which is not possible in QB64(PE), however REDIM can do the job, but "Tile" have to be a user defined TYPE instead of a function.

Code: (Select All)
Type Tile
    Symbol As String * 1 'use higher numbers if you need more chars
End Type
ReDim Goals(6) As Tile

Goals(1).Symbol = "o"
Goals(2).Symbol = "x"
Goals(3).Symbol = "*"

etc.
Reply




Users browsing this thread: 5 Guest(s)