Learning Java: Part 13: Inheritance (Part 2/2)

preview_player
Показать описание

This is the second part of my Polymorphism/Inheritance series, and with this knowledge you should be able to make your applications alot more sophisticated. Enjoy!

Thanks for watching!

Рекомендации по теме
Комментарии
Автор

For the first time, I have finally found a series of tutorials for Java that are actually providing marvelous examples! Thanks, Brandonio!

MackMillicco
Автор

You are a fantastic teacher, and I find your tutorials very useful (I am teaching myself and learning through your videos)!
Just wanted to add something extra I found for those watching this (maybe you cover this in later videos but I havent got there yet):
// overloading and overriding polymorphism
// overloading
/* a class can have two functions of the same name
* but java will use the one that corresponds to the
* inputs chosen e.g. demo(int a) and demo(String a, int b),
* if i use demo(1) it will call the first function, if I
* use demo ("hi", 2) it wall call the second even though they
* have the same name
*/
// overriding
/* child class overrides parent classes function
* parent = BankAccount, child = SavingsAccount, both have functions
* demo(int a)
* now, BankAccount Ba2 = new BankAccount(); will use parents demo
* BankAccount Ba2 = new SavingsAccount(); will use childs demo
*/

andyclarke
Автор

Thanks you for the videos, I am learning and finally understanding way more programming in a structured manner from your videos then ive learned from my 5 year higher educational study Technical Informatics. Keep on the good work.

deFreijtas
Автор

Figured my question out :P. These tutorials are helping me out so much! I'm able to go at a faster pace than my intro to java class lol. Better teacher than my current one!

TheWittleGuy
Автор

Thanks a lot man, got an advanced programming exam coming up and most other examples are far too simple for me to go away and experiment with polymorphism. This is awesome, exactly what I needed.

P.S. *cheques :p

sunbags
Автор

Because we don't have to when not using another variable with the same name, which we do because it's good code.

Bunnymancer
Автор

The advantage of using what you explained in 14:40 - 18:00 is that you can create an array that holds many different objects with the same superclass. I'm trying to figure out how I can use that to make a smart collision detection system in my games, but it's really confusing.
BTW, the syntax would be-
BankAccount[] accounts = new BankAccount[2];
accounts[0] = new SavingsAccount();
accounts[1] = new CheckingAccount();
Or any other variations.

iambored
Автор

also regarding the paraphrassing i did, here is what you said:
"however i dont like doing that cause as you can see its very confusing so.. i will just stick with calling this ChickingAccountFees (which means normal object with no polymorphism)"
so the " i will just stick with calling this ChickingAccountFees" == avoid polymorphism. (at least to me)

asdasvcxvwe
Автор

You actually used what you explained ~15:20, some minutes ago for the method l and the "Object/String s".

theCapypara
Автор

I find it amusing that you know about this stuff "very well", yet you are watching the intro to java tutorials... Also, no one is FORCING you to watch these videos, so if you don't like them spare us your negative comments and go learn it somewhere Thanks and have a great day! :)

robl
Автор

so, using the super() command inherits ALL of the constructors or just the defualt of the original bankaccount class? These videos are extremely helpful I have learned so much from you! Thanks so much for your fantastic videos... which are better than even the Harvard programming videos! Screw the people who leave the stupid comments... Thanks!!!

robl
Автор

while I'm learning I like to try and do the code first then verify with what you enter and when you did the savings account I randomly picked bob for the owner too XD

hedgechasing
Автор

Great tutorials ever very understandable !!

sweatbar
Автор

Really Really a good video, Thank you very much....

blse
Автор

Thanks for the video. All your videos have been really helpful, Brandon. Your style of explaining is awesome.

Where can I find videos on other OOPS concepts? Encapsulation, Abstraction, Polymorphism.

tealpaintbrush
Автор

I'm getting an error in the test class....The error is about the Object
When I've changed String to Object in the parenthesis I'm getting an error...

harshithgoka
Автор

is there a reason that some of time in this you have used capital letters for the first word of a method?

i.e. why "DeductFees" and not "deductFees" (i thought it was good style to not capitalise the first word)

HariltonMW
Автор

So each of the different accounts can access the methods in BankAccount, right? That is, both checking and savings accounts each have their own balances?

robl
Автор

I can not run the program in the java app

etz_
Автор

So, why aren't we using "this.remainingChecks = 100;" in the first constructor?

Bunnymancer