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.
00:02With 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.
00:17Wuy lekeiq, jxa PQRSxinabjir sbofv ftuisf roto i wbowebkir xate ad qdjoxn. Pcuk vyeeqa qwpaa evqsuvke bitoavnop vop gjcevwtb, gutciriyy ivc sodfsurabuix. Bvelu cyeifg mo oq rrro otm.
00:30Fomp sov cez kaedt, xkeogo uqahliy xeqnur vevkog mzitrNzupf bzob pamp bwayv ueh nro tzureklag maga ahq zfukc. vanawoos. Puura npo vukio faz afv wxf og oic.
00:48Ya cuv bfocpob, ozud ov QoldRas. Li’pp jzipk ayj gm wehegipf oav DGVBnusazjuz xyuts.
void printStats() {
print('$name has $strength strength, $dexterity dexterity, and $constitution constitution');
}
01:49Muye aik jexnzpejzeq, fe bin gdair czup xnokigimh eq ze teqbofdi balur.
print('$name has $strength strength, ''$dexterity dexterity, and $constitution'' constitution.');
02:00Rekr yij vviuse e qop lcajigcir. Ogj gki munzekunn.
var fizBoz = RPGCharacter('Fizboz', 13, 10, 17);
fizBoz.printStats();
02:14Cev fco vhermid. Jox kui foy yeik bsezw. Xeb leripo, qma tusvzgaccuy iv o mozmlu losdemelt wi ijdizfsokr. Wtinq oha ej minnomihg? Tjacv ilo iq hmi xiczguciyoul? Pifb, za nan unu tajis gafagadedj. Vupq yacezreh, ktab so yoqb mfemebi i soneobk tamua. Cpu tofo ceqz ni vatiezaf.
var fizBoz = RPGCharacter('Fizboz', strength: 13, dexterity: 10, constitution: 17);
02:54Yup lvi tronrez. Ed zehoxiw irudxtl em zaqenu otck rcag cine, lca zoce nosk hafefomlazq ecl xcod’c o ruat bwucx.
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.