All language subtitles for 026 Step 2 - Setter_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 Download
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
ru Russian
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

This time, we're going to the center before the geter.

The array field contains no values, so right now there's nothing to really get.

So in this lesson, we're going to add a letter that updates the cars field.

The dealership has one field, so we need to add one setar, I told you before that a seller starts

with the word set and ends with the full name.

So should our set to be called set cars?

No, said cars implies updating every object at once.

And that doesn't make any sense.

Currently, the car's array only has room for three cars.

But what if we made room for one hundred cars or a thousand cars and you only want to update one of

them?

Surely you're not going to pass in an array of a thousand objects for the sake of updating one?

The screaming cat doesn't approve.

The senator should update one object at a time and let the user choose which one.

This approach offers more flexibility.

So when your dealership class at the Sutter said car.

And it's going to take one car object as a parameter.

All right, now our dealership object can call set car and when called set car is going to receive a

car object.

But which index in the car, Zoraida, we add it to we need to add another parameter that takes an index

value int index.

And at the index chosen by the user, we're going to set that element in the car's array.

Equal to a new car object.

And we're going to call the copy constructor by passing in a source object.

Also, notice that I'm setting the area equal to a copy of the car object, and I'm not just setting

them equal to each other.

You don't want your field to get caught in the reference trap.

Get in the habit of creating a new object and using the copy constructor to copy every value from a

source.

Right after we're creating a new car object, we're passing in a source object down the nose to run

the copy constructor that receives one as a parameter.

And then it's going to copy every field value from the source object into the one we just created.

And remember that this refers to the current object that's called the A constructor or method.

All right, now we can update the cars right in Maine, we're going to update the first index in the

cars field with the Nissan Object dealership that said car.

Nissan.

At Index zero.

And now update index one with the Dodge object.

And indexed to what, the second Nissan?

And they're now your dealership has three cars.

First, you're setting the element at index zero equal to a new car object, and after creating the

new object, you're passing in a source.

So have a nose to run the copy constructor, which copies every field from the source object into the

current object.

You did the same thing for index one and two.

And now your dealership is full of cars.

Now, before we wrap up, you can clean up our code a little, instead of defining three separate car

variables, we can define an array of cars.

Currys.

Is equal to a new array of car objects.

The first element in the array is a car object with fields that describe a Nissan.

The second element in the array is going to be another car object with fields that describe a dodge.

And the third element of the car object is also going to be a Nissan, but with a color of yellow.

And a new set of parts.

Also, by the way, this.

Is the same thing, is this.

And you know what, we can also pass this array directly.

And now we can pass in the car object at index zero.

Index one.

An index to.

And now you might be wondering, isn't there a better way to do this and you would be right to assume

so instead of writing the same code three times a week can create a far loop that runs through the length

of the car's array.

By the way, since you're familiar with loops at this point, I don't mind showing you a trick to autocomplete

A for loop.

Just click on Fawry.

And what this does is it creates a loop that runs through the length of the nearest Thouret, pretty

convenient.

I didn't want to show it to you before just because I wanted you to practice creating loops.

But right now, I know you're an expert.

Anyways, during each run, we're going to call a set car.

And we're going to index a car object and pass it in as the first argument and in the second argument

pass in the index, that's it.

Ultimately, the Sloup is going to update the cars filled with car objects, that index is zero one

and two.

In this lesson, you added a Seder.

The Seder set car receives two values, an object and an index, and then it updates the array at an

index of your choice.

You updated index zero of the cars field with the Nissan object.

One would dodge.

And indexed to what, the second Nissan?

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