All language subtitles for 013 Review on 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 spoke about constructor functions defined on classes.

We also went through a little bit of a shortcut on assigning a property straight through the constructor

without having to add any additional function code to the constructor itself.

So in this section, we're going to do a quick review on what just happened, just to make sure that

it's really crystal clear, because this abbreviated syntax right here of initializing a property name

directly from the constructor is something that you're going to see all throughout this course in a

tremendous amount of documentation on D'Arte as well.

So let's get to it.

And I put together a quick diagram to help you understand what is going on.

And the first thing I want to remind you about is that you and I added a function to the class.

The functions name was person with a capital P because that function name was absolutely, positively

identical to the class name.

It became the constructor function for this class automatically.

Remember, a constructor function gets called automatically any time that's been defined on the class,

and it is our place to do some initialization or setup of the class instance.

Inside this constructor, we specified an argument list with exactly one argument on it, inside that

argument list, we wrote out this first name.

This means that in order for us to create a new instance of a person, we have to call a new person

and provide exactly one argument to it.

So specifically because we wrote out an argument right here that means any time we create a new instance

of a person, we have to provide one argument as well.

Now, the interesting thing about that argument that we listed there was that on the front of the argument

name we put on this dot and then we wrote out a property name or the name of a property or field that

belongs to this class because we followed that strict rules because we have this dot and then exactly

the field name right here darte decided to automatically take this argument of string, Stephen, right

here or whatever your name is in your case, and automatically assign it to the first name property

for us.

So again, specifically because we used this dot and then the exact name of the property, this got

assigned to the correct property name for us to give you a very, very quick demonstration of exactly

how that worked.

I'll flip back over to Pat over here.

Now I want to find that constructor function and I'm going to try changing first name right here to

something else, like maybe something like my first name.

Now, when I do so, you'll notice that I've got an error message down here, it says My first name

isn't a field on the inclosing class.

However, if I remove the this dot from this thing.

Then you'll notice that the error message goes away, so it's specifically the combination there of

putting this dot and the exact property name that allows us to take this shortcut in adding this property

to the class person.

So I'm now going to revert that back to this dot first name and now my code is going to work as it did

before, exactly as we expect.

OK, so again, in the section we spoke about constructor's and we spoke about this little shortcut

right here for assigning fields to a instance of a class, whenever we call the constructor function

and we call that constructor function by using the new keyword right here and then referencing the class

name.

It's now that we've got a good overview on this, let's continue in the next section where we're going

to start working on our next project that's going to heavily involve classes.

So quick break and I'll see you in just a minute.

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