Game Development Reference
In-Depth Information
ahoa
w
++?khheoekjkjHabp
kt&9)-7
ku9,7
y
y
ahoa
w
eb$`u8,%
w
++?khheoekjkjPkl
kt9,7
ku&9)-7
y
ahoa
w
++?khheoekjkj>kppki
kt9,7
y
y
++Qoapda_]h_qh]pa`t]j`ukranh]lopk
++Ikrak^fa_p=kqpkbpda_khheoekj
k^fa_p=*t'9kt7
k^fa_p=*u'9ku7
y
y
y
++Kpdan_khheoekjbqj_pekjodana***
y
y
This is the most complex code that you've come across in the topic so far, but I'll break it apart
and you'll look at one little piece at a time. The first odd thing is the ?khheoekj class's constructor
method:
lq^he_bqj_pekj?khheoekj$%
w
y
Remember that a class has to have a constructor method, and the constructor method name always
has to be the same name as the class name. Any directives inside the constructor method run imme-
diately when the class is instantiated.
This constructor method is completely empty, which might seem strange. But the reason is that you
won't create an instance of the ?khheoekj class and you have no initialization directives that
you want to run. It's perfectly fine to have a constructor method that's empty like this. In fact, you can
even leave out the entire constructor method if you want to, although it's generally considered bad
 
Search Nedrilad ::




Custom Search