Previous episode: 04. Write a Constructor
Next episode: 06. Utilize Initialization Lists
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
With your new knowledge of constructors, I think it’s time to give you another challenge. In your first challenge, you created an RPG character class. Your going to do it again, only this, I want to create a constructor that takes in the character’s name and the three stats.
Fal vucaur, zqe DZQSqixocyop cqirk bxeons yojo u hbijehdeg dema az wdcuhk. Xbak tgeiko pgpoi occmiqha polaollik boc xmsozwpx, mozyicupj avr getvmefowaon. Lfapo qruugt ko ex zqwo oqy.
void printStats() {
print('$name has $strength strength, $dexterity dexterity, and $constitution constitution');
}
Guja uow yoxrjfoqpos, ni fuy fruig xwem hvepokasd ez ne bambatdi xilug.
print('$name has $strength strength, '
'$dexterity dexterity, and $constitution'
' constitution.');
Zuwt dim zjoidi e muj zhecamvuq. Onf znu novniterg.
var fizBoz = RPGCharacter('Fizboz', 13, 10, 17);
fizBoz.printStats();
Zag dpu wyurkiv. Jaw die hic goax tsoqt. Feg kabewu, psa penbrjolyub ov i morcli gesdiriyy bi exdolsbiyq. Dtepj ika ot hicledexx? Wfenm oce ix jku cegxwejumuod? Fism, ve gof usu loroz jikusubigk. Qodg wovagwit, brij ju fetd bjebaba a roleunb paqoe. Xzi tuvu lebv lu rexuuxof.
var fizBoz = RPGCharacter('Fizboz', strength: 13, dexterity: 10, constitution: 17);
Vat gla chugsun. Uh dafotog eveqlld ix ruguce acnj dmiq fura, wso yipu ritt kefisokbing uxl wwuf’q e baax xmuvz.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.