All language subtitles for 005 More Initialization with Constructors_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

In the last section, we started talking about how we're going to begin adding different methods to

our deck and card classes will first begin with this first task up here.

So we want to have the ability to create a new deck and make sure that there are 50 to playing cards

inside of it.

Remember, a standard deck of cards has 52 cards for suits and 13 ranks, or however many 13 ranks.

Now, one thing I want to make really clear here is that even though I'm kind of indicating right here

that these are a bunch of methods that are going to exist on the deck, this make a deck function right

here?

Well, it's a little bit different than the other functions you see listed on here.

Let me tell you why.

I want you to imagine that at some point in the future, after we finish up this deck class and the

card class, we end up writing out our main function.

And then maybe inside this main function, you and I write some code to create a new instance of the

deck class.

So maybe we would write something like var deck is new deck.

Now, I don't know about you, but I would really expect that the instant I called New Deck right here,

I would just poof, magically get fifty two cards added for me to this card's property or this cards

field.

I would not want to have to run some additional method or additional function like, say, deck at all

cards or something like deck build my cards or something like that to generate those fifty two cards

and add them to this list.

In other words, I want to make sure that the instant I create a new deck, I automatically get 52 cards

added to this cards property.

So what I'm kind of driving out here.

Long story short, I think that we need to add a constructor function to the deck class.

So the instant we create a new instance of deck, we automatically get the opportunity to do some initialization

of our deck class and add those 52 cards in without having to require an extra function call like that

or any additional kind of hubbub to get this class initialized.

So I'm going to clean up this main function right here and then inside the declasse, I'm going to add

on my constructor function.

We just spoke about constructor functions a moment ago.

Remember to define one inside of a class.

We write out the exact name of the class as a function inside the class body.

So because my class name is Deck with a capital D. I'll add on a new function called Deck Place my parentheses

and then my curly braces like so.

So now this function right here is going to be called automatically every time we create a new instance

of a deck, which makes it a perfect location to create our big list of cards and add it to this cards

property right here.

OK, so let's take a quick pause right now.

We'll come back in the next video and start implementing the logic to add all of our cards to that cards

list.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.