Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Objects can perform actions.
Fields work together to describe an object, a car as described by its milk price, year and color,
and based on the requirements, a car can also perform one action.
It can drive.
In this lesson, you're going to have to drive action to the car class.
So what is an action, an action is a method, a function, an action is a method that represents what
the object can do.
From the requirements, we found that a car can perform the drive action, so we need to drive action
to the car class.
So in the car class at a method called drive public, the method is not going to return anything.
It's called drive and it's not going to receive any parameters.
All right, now, every car object that you make from the car class can call the drive method pretty
cool.
And the drive method is going to print every field from the object that calls it as part of a nice string.
So we're going to print line.
You bought the beautiful.
This year.
Add some space.
This color.
Add some more space.
And print the make field of the current object.
And then we'll say for.
The price of the current object.
And after that, we'll say, please drive your car to the nearest exit.
Followed by a new line.
OK, I think it's time to remove these print statements, and I'm going to call the drive action from
the Nissan object.
And sure enough, it prints every field and the car essentially drives.
The object caused the drive method, Jabor runs the drive method.
This points to the current object that's calling the method and the method prints every field that describes
the current object.
I'm going to call this method from every object.
And sure enough, it prints every field from the object that calls it.
In this lesson, you added an action to your car class, an action describes what the object can do,
the requirements tell us that a car can drive.
So you added a drive method to the car class and now every car object can call that action.
And when called, it essentially prints every field that describes the current object as part of a nice
string.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.