Page 1 of 1

HMG Create object

Posted: Thu Oct 22, 2015 12:35 pm
by miszler.zoltan
Hello guys!

The following structure could achieve what way?

myCar = new Object()
myCar.make = "Ford"
myCar.model = "Mustang"
myCar.year = 1969

MsgInfo( 'My Car: ' + myCar.make +' '+ myCar.model )

Best regards, Zoltan

Re: HMG Create object

Posted: Thu Oct 22, 2015 3:55 pm
by mustafa

Code: Select all


#include "hmg.ch"

Function Main()

 myCar_make  = " Ford "
 myCar_model = " Mustang"
 myCar_year  = " 1969"

MsgInfo( 'My Car: ' + myCar_make + myCar_model + myCar_year )

Return

Hello Zoltan
Have if you can serve
Mustafa

Re: HMG Create object

Posted: Thu Oct 22, 2015 4:58 pm
by miszler.zoltan
Hello Mustafa!
Not variables, or array, but I object to solve ...

Re: HMG Create object

Posted: Thu Oct 22, 2015 5:53 pm
by luisvasquezcl
Hi,
you can do the following:
#include "hbclass.ch"
#include "hmg.ch"

proc main
local Mycar := Car()
myCar:make = " Ford "
myCar:model = " Mustang"
myCar:year = " 1969"

MsgInfo( 'My Car: ' + myCar:make + myCar:model + myCar:year )
return

class car
data make, model, year
end class
i hope it will be helpful
Best regards
Luis Vasquez

Re: HMG Create object

Posted: Thu Oct 22, 2015 5:59 pm
by luisvasquezcl
They can initiate variables with values as follows:
CLASS Car
DATA Make AS CHARACTER INIT ""
DATA Model AS CHARACTER INIT ""
DATA Year AS CHARACTER INIT ""
END CLASS

Re: HMG Create object

Posted: Thu Oct 22, 2015 8:07 pm
by Amarante
Hi Zoltan,
There you will find an example I made using objects as well as SQL.
http://hmgforum.com/viewtopic.php?f=37&t=4293#p40736

I hope you find it useful.
Regards
Amarante

Re: HMG Create object

Posted: Fri Nov 06, 2015 7:51 am
by miszler.zoltan
Gentlemen!
Thanks to the joint thinking and answers!