[netrexx-course] Q:Help: Classes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[netrexx-course] Q:Help: Classes

kikuti hisasi
hello,

I want to make a program something like the followings.  but I can't make it work.
Could someone help me.

kikuti


-----------------------------------------
agame1=Agame
agame1.lesmoves[1].fromsquare.row=2
agame1.lesmoves[2].fromsquare.row=4
say agame1.lesmoves[1].fromsquare.row


class Agame
properties public  
lesmoves=Move[300]

class Move
properties public
piece=int
fromsquare=Square
tosquare=Square

class Square
properties public  
row=int
col=int
----------------------------------------

-----
Free e-mail group hosting at http://www.eGroups.com/
------------------------------------------------------------------------
Subscribe, unsubscribe, opt for a daily digest, or start a new e-group
at http://www.eGroups.com -- Free Web-based e-mail groups.


Reply | Threaded
Open this post in threaded view
|

[netrexx-course] Re: Q:Help: Classes

kikuti hisasi

hi, i've got an answer to my question at com.lang.java.help

kikuti

------------------------------
The problem is that in Java unlike in C++, doing a
new to initialize an array only allocates space
for the array pointers. It does not initialize any
new objects.

---------------------------------------


hello,

>
> I want to make a program something like the followings.  but I can't make it work.
> Could someone help me.
>
> kikuti
>
>
> -----------------------------------------
> agame1=Agame
> agame1.lesmoves[1].fromsquare.row=2
> agame1.lesmoves[2].fromsquare.row=4
> say agame1.lesmoves[1].fromsquare.row
>
>
> class Agame
> properties public  
> lesmoves=Move[300]
>
> class Move
> properties public
> piece=int
> fromsquare=Square
> tosquare=Square
>
> class Square
> properties public  
> row=int
> col=int
> ----------------------------------------


-----
See the original message at http://www.egroups.com/list/netrexx-course/?start=120
--
Free e-mail group hosting at http://www.eGroups.com/
------------------------------------------------------------------------
Subscribe, unsubscribe, opt for a daily digest, or start a new e-group
at http://www.eGroups.com -- Free Web-based e-mail groups.