Simulating C++ Constructors

Find quick help here to get you started with Hollywood
Post Reply
tolkien
Posts: 195
Joined: Sun Oct 17, 2010 10:40 pm
Location: Spain

Simulating C++ Constructors

Post by tolkien »

Hello friends!

I´m using Hollywood in a OOP way and I ised to use a function like constructor for my objects....you know.
But, what if I want to create a different constructor that accept, for example, arguments? Hoy can I use the same name of the function?

Hope you understand!

Thanks!
Mazze
Posts: 69
Joined: Thu May 06, 2010 8:08 pm

Re: Simulating C++ Constructors

Post by Mazze »

You could use a function with "variable number of arguments" (see documentation)

Code: Select all

Function test(...)
    ; arguments will be stored in table 'arg'
    DebugPrint(arg.n .. " arguments")
EndFunction

test()
test(5,6)
test(1,9,"aaa",b)
tolkien
Posts: 195
Joined: Sun Oct 17, 2010 10:40 pm
Location: Spain

Re: Simulating C++ Constructors

Post by tolkien »

Mazze, you are amazing! ;) Now I remember had read something in the documentation. Thanks!
Post Reply