11. How to program in C# - INHERITANCE - Beginner Tutorial

  Рет қаралды 246,739

Brackeys

Brackeys

Күн бұрын

Пікірлер: 243
@yorkman25
@yorkman25 7 жыл бұрын
The first 10 videos have covered one whole semester of c# at my university. Thank you so much.
@Triggerly
@Triggerly 5 жыл бұрын
wow
@bsh7390
@bsh7390 4 жыл бұрын
will you pay him after you managed to make money with C #? because he taught you whole semester course
@orbitalop3842
@orbitalop3842 9 жыл бұрын
These are the best C# tutorials I've found on youtube, and would recommend them to anyone wanting to learn C# . Thanks for the tutorial brackeys, it is much appreciated.
@Brackeys
@Brackeys 9 жыл бұрын
Orbital OP Wow thanks! That means a lot :D
@magnusm4
@magnusm4 9 жыл бұрын
+Orbital OP also for Java, they are almost identical but this one feels much better.
@LayZeeChannel
@LayZeeChannel 8 жыл бұрын
"And we're simply gonna call him, Heisenberg." I cracked up at this moment XD 10:40
@sonic26000
@sonic26000 8 жыл бұрын
I don't practice as much as I should, so I always forget how classes an inheritance work. I'm glad your videos are here. They make a great refresher!
@ShizzleMyChizzle
@ShizzleMyChizzle 7 жыл бұрын
Dude you are incredibly good at explaining! 14 minutes of pure gold.
@antonijabaric8389
@antonijabaric8389 9 жыл бұрын
I know C++ really good but because of one class on college I needed to learn C#. I like this C# so much and it's way much easier than C++. I learned this program in one afternoon. There is no pointers, references, overloading operators ect. Thank you Brackeys and hope you'll keep doing such a good tutorials.
@MattBee2k2
@MattBee2k2 7 жыл бұрын
I did c# first then uni threw C++ at us and I couldn't get my head round some of it, it's so unnecessarily complicated.
@alimertc
@alimertc 6 жыл бұрын
Well, it isnt "unnecessarly complicated". Its just "unnecessarly complicated" compared to your needs. It has its uses.
@MattBee2k2
@MattBee2k2 9 жыл бұрын
Learn programming at uni but your tutorials are a great way to learn programming, really put things into perspective that I don't understand at uni, thanks.
@thesilvercreepers
@thesilvercreepers 4 жыл бұрын
These are the most easy to understand tutorials I've ever watched, great job 👍
@Combat9259
@Combat9259 7 жыл бұрын
I think you just saved my life. You make everything way more easy to understand!
@TheGuruDesign
@TheGuruDesign 9 жыл бұрын
I must say this was a good video out of all your other "Free" tutorials. You recapping at the end was really good! I like how you showed inheritance through one .cs program document. Its kinda different from Unity that breaks each class into its own .cs document but the same logic "VERY SAME LOGIC!!!!!!!!". good job Brackeys
@rebeccad.collins2617
@rebeccad.collins2617 5 жыл бұрын
Watching your videos has literally raised my programming grade by an entire letter! Thank you so much for making these videos, you are by far the most concise content creator for learning to code. Very much appreciated!
@catleysama
@catleysama 9 жыл бұрын
I love how so many people share their games that they made from your tutorials i the description its awesome :D
@SnappyYouT
@SnappyYouT 9 жыл бұрын
You're awesome!
@Brackeys
@Brackeys 9 жыл бұрын
Snappy No sir, YOU are awesome :D
@SnappyYouT
@SnappyYouT 9 жыл бұрын
Brackeys YES!!! I FEEL YOU!!!
@timschel
@timschel 8 жыл бұрын
no all are awesome! :D
@scottev954
@scottev954 8 жыл бұрын
Very easy-to-follow overview of a complex and important topic. Thanks for your time and energy.
@Garross2
@Garross2 9 жыл бұрын
I love seeing Brackeys get actually invested in the characters he is creating xD lol.
@shadilios
@shadilios 5 жыл бұрын
Brackeys: *leaves an extra space by mistake* "oops" Me: Fucks up a page of code and don't give a damn lmao
@tomaina7924
@tomaina7924 7 жыл бұрын
Super awesome tutorials!! I am here from 2018 now and learning from your vids!! Your content is amazing!!
@Zeljikalka
@Zeljikalka 7 жыл бұрын
Heisenberg - a typical cat name xD
@JP-monkeybot
@JP-monkeybot 6 жыл бұрын
It really should have been Schrodinger...
@dipanjanghosal1662
@dipanjanghosal1662 4 жыл бұрын
@One cheeky bih happiness level 0.3. Walt is never happy lol
@muhammadsultankhan8450
@muhammadsultankhan8450 4 жыл бұрын
and it was also obvious.... XD
@gyattrizzV
@gyattrizzV 2 жыл бұрын
thank you brackey you are a save my entire life
@joshsansom8814
@joshsansom8814 8 жыл бұрын
Brackeys I have learned so much from your vids. Thanks dude.
@zibusisondlovu5577
@zibusisondlovu5577 2 жыл бұрын
Natural born teacher sir!!
@MrR3dw3as3l
@MrR3dw3as3l 8 жыл бұрын
Thanks man for these tutorials! I really appreciate your work. C# is my new favorite language :D
@bullorus2475
@bullorus2475 9 жыл бұрын
Thanks for these courses Brackes!
@Brackeys
@Brackeys 9 жыл бұрын
Bullorus You are welcome man :D
@bullorus2475
@bullorus2475 9 жыл бұрын
So are you :) Do you plan on making this a grand series, because i feel like there is still a lot to learn?
@nickspirakus8008
@nickspirakus8008 8 жыл бұрын
Great work on all of your videos. Definitely helped me grasp basic C# syntax and code formations!
@BramVanbilsen
@BramVanbilsen 8 жыл бұрын
In the previous video, you told us to make the class outside of the main class but now you are making it inside the main class. Is there a difference?
@johnmoore4248
@johnmoore4248 8 жыл бұрын
Bram Vanbilsen There's no difference mate as long as they r in the same namespace (even if both are placed in different file (.cs aka C# code file like . java/.py). If they r not in the same namespace, u need to use (using namespace'name.class'sname). Which is like #using myNewNameSpace.myNewClasd. Cheers.
@joro353
@joro353 7 жыл бұрын
Thanks for clarifying Moore John.
@liam9996
@liam9996 6 жыл бұрын
joro353 There is one, you dont have to jump between methods or classes
@tahaahmed5292
@tahaahmed5292 8 жыл бұрын
Hey Brackeys i tried the Animal.Count in this Video,it Works. awesome
@bamcodes
@bamcodes 9 жыл бұрын
Brackeys , man I love your videos , thanks man . You're awesome !
@1julianoni
@1julianoni 8 жыл бұрын
Thanks you did a great job in explaining this, the RPG example is what made it make sense to me.
@jonlbs7
@jonlbs7 4 жыл бұрын
Your videos are EXCELLENT !!😊👌
@BlackLight650
@BlackLight650 7 жыл бұрын
You are a wonderful conveyer of methods and instructions sir. Thank you for these videos.
@faremy
@faremy 7 жыл бұрын
This was fun ! Mix this with class constructors and you manage to get a very clean code in your Main method that does quite some work ! Thx for this tutorial ! :§
@kocornik
@kocornik 5 жыл бұрын
Swear to god brackeys has a video for everything
@CM-ng1ef
@CM-ng1ef 9 жыл бұрын
These are very well done tutorials. They have really helped me learn about C#. Now that i have a basic base knowledge I think I will go to your "make a game" series.
@Brackeys
@Brackeys 9 жыл бұрын
Dovah Kiin definitely do that! be aware the make a game series is in javascript ;)
@chasekilleen1459
@chasekilleen1459 3 жыл бұрын
I love this guy's voice, so fucking smooth
@sifundomhlungu5119
@sifundomhlungu5119 6 жыл бұрын
I freaking fell in love with inheritance after watching this video
@ftcgames4816
@ftcgames4816 8 жыл бұрын
finally! thanks been looking for an explanation of inheritance!
@mouwersor
@mouwersor 6 жыл бұрын
Finally someone who doesn't use vehicles as a metaphor..
@stelioskarydakis388
@stelioskarydakis388 8 жыл бұрын
finallyyyy a great video about inheritance..amazing!!great job thank you!!
@_catulus
@_catulus 4 жыл бұрын
Remarkably helpful. I have to make goblins, skeletons, spiders, zombies, imps, wizards, and succubi. Needless to say, this will make it much easier. Thanks!! :D :D
@SunriseDreams-
@SunriseDreams- 4 жыл бұрын
What a legend! Thank you so much for the help. :)
@NardeenEmadOumar
@NardeenEmadOumar 8 жыл бұрын
:D yaaaaaay you just taught me inheritance in such funny and easy way :D thank you
@Brackeys
@Brackeys 8 жыл бұрын
+Nardeen Emad.Oumar Great! you're welcome ;)
@NardeenEmadOumar
@NardeenEmadOumar 8 жыл бұрын
+Brackeys I got an A+ on today Quiz :D
@gokayakcay7093
@gokayakcay7093 8 жыл бұрын
Thanks. Your lessons are very simple and practical.
@AlexM19875
@AlexM19875 3 жыл бұрын
class Character class Player : Character class Bot : Character Thank you! This helped :P
@Trickeriz1
@Trickeriz1 8 жыл бұрын
amazing work !! love your tutorials . ive learned soo much ! keep going HERO!
@clayrobb5862
@clayrobb5862 6 жыл бұрын
Hey man. Thanks so much, really helped! Keep up the good work.
@hadiagul312
@hadiagul312 5 жыл бұрын
You're awesome!you've taught me more about programming over the past 20 hrs than my teacher has in 9 months. THANK YOU!!!In the previous video, you told us to make the class outside of the main class but now you are making it inside the main class. Is there a difference? The first 10 videos have covered one whole semester of c# at my university. Thank you so much. 216 likes 0 dislikes now this is how it should look like.:D yaaaaaay you just taught me inheritance in such funny and easy way :D thank you Why are the class definitions within the class "Main Class"? Why put them inside "Main Class" as opposed to new classes within the namespace "First Console Project"? Is it for accessibility?The first 10 videos have covered one whole semester of c# at my university. Thank you so much. please you can make some tutorials with visua studio to show how to make windows forms apps 7Yay! No dislikes! The haters finally realised that this is the best C# course.These are the best C# tutorials I've found on youtube, and would recommend them to anyone wanting to learn C# . Thanks for the tutorial brackeys, it is much appreciated.I know C++ really good but because of one class on college I needed to learn C#. I like this C# so much and it's way much easier than C++. I learned this program in one afternoon. There is no pointers, references, overloading operators ect. Thank you Brackeys and hope you'll keep doing such a good tutorials.I've been really interested in making a third person shooter game for a long time. I would greatly appreciate I if you could create a tutorial series on it.Brackeys: Now our dog class... Auto EN caption: Now our dark class... Darth Vader: wat ( ͡° ͜ʖ ͡°) 1
@Streta2k11
@Streta2k11 9 жыл бұрын
Another great tutorial, thanks Asbjørn.
@AkinJanet
@AkinJanet 7 жыл бұрын
thanks for your neat and clean tutorials
@TheCrow2269
@TheCrow2269 3 жыл бұрын
Dude!! Thank you!! I understand it better!! Thank you
@dontmindletsplay
@dontmindletsplay 8 жыл бұрын
So you would use this to for example have a base calls called weapon. and then give different weapons properties like strenght, weight and such. I dont know how long it would have taken me to learn this with books and teachers. but in just one day i feel like im starting to understand the basic c# language. And for that i thank you! Not only great tutorials, but free as well! really appreciate you doing this. You are awesome!
@dudenarima2528
@dudenarima2528 4 жыл бұрын
you can say no to inheritance, but you'll need much much MUCH more code to write and if you forgot smth, you'll need to overwrite every class but with inheritance it becomes more compact and understandable
@Karlponken
@Karlponken 8 жыл бұрын
Very good explanation, keep up the good work!
@raihanurrahman503
@raihanurrahman503 6 жыл бұрын
watched one of your videos and the result...SUBSCRIBED!
@vanshyadav4533
@vanshyadav4533 6 жыл бұрын
The example of an RPG for inheritance, made me understand inheritance, which I couldn't do for the past 4 months
@johnmoore4248
@johnmoore4248 8 жыл бұрын
Hi Brackeys, it is awesome. But, it will be perfect if u use Constructor as u did in heritance tutorial. BTW, your Interface tutorial is really really good and it's different from others explaination. Which helps me a lot. Thanks mate. Cheers. 😃
@MaximumBloop
@MaximumBloop 5 жыл бұрын
10:14 so i coded everything exactly as it is written and the program ran this New Happiness : 9.0000004 why?
@dainp2005
@dainp2005 5 жыл бұрын
Same here, I think it has something to do with floats not being as strict as doubles, so decimals like this I have been informed to use doubles instead of floats, but I don't know the reasoning. I got 0.90000004 though
@ADMAtions
@ADMAtions 5 жыл бұрын
Same
@prod.immortalized
@prod.immortalized 4 жыл бұрын
it has to do with floats not being as accurate as doubles
@IrfanAli-so5hh
@IrfanAli-so5hh 4 жыл бұрын
Same problem here too!
@theduckfliesagain
@theduckfliesagain 9 жыл бұрын
Hey, thanks for all these great tutorials!! How often are you planning to upload these c# ones?
@DannyBurkeBanjo
@DannyBurkeBanjo 9 жыл бұрын
thanks, your videos are really clear and are helping me a lot!
@stavvers
@stavvers 6 жыл бұрын
Fantastic video! thank you so much!
@gamerspecial4562
@gamerspecial4562 4 жыл бұрын
you are very good ad giving leasons thank you very much i have learnd a lot
@halaabjar7665
@halaabjar7665 6 жыл бұрын
wonderful teacher I like the way it is simple and so useful
@VeeZzz123
@VeeZzz123 4 жыл бұрын
very informative, well explained
@Pr3DaToR15
@Pr3DaToR15 8 жыл бұрын
Very helpful! Thanks.
@swishyfeather
@swishyfeather 7 жыл бұрын
These are great, THANK YOU! I've been following along in Visual Studio and saving some of the important parts. I keep having to refer back to for and while loops though, can't seem to get those memorized. Everything has been pretty great! (=
@RnW154
@RnW154 9 жыл бұрын
So I've spent the majority of the day on these and have covered alot of ground! Thank you so much Brackeys! Made this so easy to understand! perhaps now I'll be able to make more sense out of the other stuff i've seen on the net. Can't wait to hear about the remaining 2 pillars. is their any online material that you'd recommend from this point on?
@MosquitoMurderer
@MosquitoMurderer 8 жыл бұрын
Awesome tutorials! I like how you use examples that are straight forward and easy to understand, definitely helps with the learning.
@UndergroundDev
@UndergroundDev 9 жыл бұрын
Great tutorial as usual :D
@ftcgames4816
@ftcgames4816 8 жыл бұрын
do you think you will make an intermediate-advanced tutorial series?
@danzafrir3416
@danzafrir3416 4 жыл бұрын
I just found this video because I have a test in like 3 hrs( gonna fail don’t even hope for me) and I know I am gonna be learning a lot from this playlist
@DanKardell
@DanKardell 8 жыл бұрын
Great job. How to you call the Cat Constructor when you want to pass parms that are in the base class?
@scorch_d62
@scorch_d62 9 жыл бұрын
Why are the class definitions within the class "Main Class"? Why put them inside "Main Class" as opposed to new classes within the namespace "First Console Project"? Is it for accessibility?
@johnmoore4248
@johnmoore4248 8 жыл бұрын
Hi Alan Armero, this question have been asked by sb. Here is the answer. There's no difference mate as long as they r in the same namespace (even if both are placed in different file (.cs aka C# code file like . java/.py). If they r not in the same namespace, u need to use (using namespace'name.class'sname). Which is like #using myNewNameSpace.myNewClasd. Cheers.
@BobDavidsons
@BobDavidsons 5 күн бұрын
@@johnmoore4248 nah your john moore
@Zasfarr
@Zasfarr 9 жыл бұрын
Fantastic work! May I suggest a video on polymorhism? It's been so stressed in my coding courses and I think it would be well worth the video!
@camspythepro
@camspythepro 9 жыл бұрын
Could you do an in-depth video on the String.Format method please? P.S. This is probably one of the best c# tutorial series ever.
@noahspagnolo9348
@noahspagnolo9348 9 жыл бұрын
Yay! No dislikes! The haters finally realised that this is the best C# course.
@antoine8611
@antoine8611 6 жыл бұрын
Well you're three years late so... xD
@tabbypp
@tabbypp 7 жыл бұрын
wonderful tutorial!! Thank you!
@vxern2443
@vxern2443 6 жыл бұрын
Thanks for tuning in at brackiiis
@coolimdad
@coolimdad 3 жыл бұрын
4:54 why did i already know it would be bark? is it just so natural?
@ahmed_gamal2006
@ahmed_gamal2006 6 жыл бұрын
Thank you dude I have learned alot
@muhammadsultankhan8450
@muhammadsultankhan8450 4 жыл бұрын
I am having a problem, .i was doing just like what was he doing in video as it is....but when i spawned a new dog and named it spotty as in the video then it goes down like spotty.name="spotty"; it was giving no errors in video but it is giving me errors in my code...it is saying: "Member Animal.type can not be accessed with an instance reference; qualify it with type name instead." bu when i type : Dog.name="Spotty"; it goes fine....i want to know why i can't write like brackeys...why it is giving me errors why is that happening to me and not happening in video...i checked again and again that what am i doing wrong but all the things were just same as he coded in video like i copy pasted it...Please help me with that..
@TheBosniaSarajevo
@TheBosniaSarajevo 8 жыл бұрын
If I could give you 20000 thumbs up on every video, I would! Thanks!
@LayZeeChannel
@LayZeeChannel 8 жыл бұрын
By the way, great series.
@atincuzun
@atincuzun 9 жыл бұрын
Wow its been a while since we had seen a video from this tutorials thanks! Asbjorn can tell an approximate number of videos that will be in this series?
@HesterLiong
@HesterLiong 8 жыл бұрын
I love your videos!
@AndreasWaatz
@AndreasWaatz 6 жыл бұрын
Tack :)
@mr_easy
@mr_easy 9 жыл бұрын
I have a question: Do private members of the base class also get inherited to the derived class?? And thanks for the tutorials :)
@Brackeys
@Brackeys 9 жыл бұрын
Rishabh Gupta Short answer: Technically they do but you can't access them from within the derived class. If you want the protection of a private variable while being able to access it you should use the 'protected' keyword :)
@jacobbarrett2020
@jacobbarrett2020 9 жыл бұрын
I've been really interested in making a third person shooter game for a long time. I would greatly appreciate I if you could create a tutorial series on it.
@magnusm4
@magnusm4 9 жыл бұрын
+Jake Barrett That would be great. A tutorial on how to make different cameras. The mmo above free control that pass through things view. RE stationary and still/following that change between areas view. Gliding on objects and glide after the player smoothly rather than constantly in the middle. Or moving ahead of the player depending on where you go.
@GFC1337
@GFC1337 6 жыл бұрын
LETS GO BRACKEY'S
@jirikoun7699
@jirikoun7699 7 жыл бұрын
Right, you are awesome, and not with a hindy accent :-) Thanks a lot!
@sergiorodrigo6504
@sergiorodrigo6504 7 жыл бұрын
Great tutorial meaby I suggest adding the type of animal to the code in this way: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Chapter11_Brackeys { class Program { class Animal { public string name; public string tipo_animal = "unknown"; public int age; public float happiness; public void PrintBase() { Console.WriteLine("Tipo Animal: {0}" ,tipo_animal); Console.WriteLine("Name: {0}", name); Console.WriteLine("Age: {0}", age); Console.WriteLine("Happiness: {0}", happiness); } } class Dog : Animal { public int spotCout; public void Bark() { Console.WriteLine("WUF!"); base.happiness += 0.1f; } } class Cat : Animal { public float cuteness; public void Meow () { Console.WriteLine("MEOW!"); } } static void Main(string[] args) { Dog spotty = new Dog(); spotty.tipo_animal = "Dog"; spotty.name = "Spotty"; spotty.age = 4; spotty.happiness = 0.8f; spotty.spotCout = 25; spotty.PrintBase(); spotty.Bark(); Console.WriteLine("New Happines {0}", spotty.happiness); Console.WriteLine(); Cat heisenberg = new Cat(); heisenberg.tipo_animal = "Cat"; heisenberg.name = "Heisenberg"; heisenberg.age = 13; heisenberg.happiness = 0.3f; heisenberg.cuteness = 0.4f; heisenberg.PrintBase(); heisenberg.Meow(); Console.ReadKey(); } } }
@efwyatt
@efwyatt 8 жыл бұрын
Thank you for this!
@cristianocolangelo7745
@cristianocolangelo7745 9 жыл бұрын
Hello Brackeys! Could you do more advanced videos? Like, this is a beginner course, after this could you consider the idea to do an advanced course? Thank you!
@DeathGOD7
@DeathGOD7 6 жыл бұрын
thats how the tutorial should be and also brief of all the things like from 12:34 and so on
@kamranbadirov7603
@kamranbadirov7603 6 жыл бұрын
Thank you very much for this awesome video! I have a question though. "New happiness" which was adjusted inside the Bark() method. I didn't get that part. If it's added inside the method, should it be printed out automatically when you call Bark() method? Instead you had to write Console.Writeline(new Happness. )
@incalite
@incalite 8 жыл бұрын
Auto thumb up dude! You rock! :D
@halaabjar7665
@halaabjar7665 6 жыл бұрын
the best one thank you
@JM-vx9fu
@JM-vx9fu 4 жыл бұрын
What tool do you use to record your lecture videos? I am a teacher and I need to record videos due to the current situation to help my students?
@CM-ng1ef
@CM-ng1ef 9 жыл бұрын
I truly can think of no more of an impractical cat name than 'Heisenberg'.
@muramasa7537
@muramasa7537 6 жыл бұрын
So inheritance is basically making/having many base classes n sub classes inside 1 mainclass ?
@realcolormusic
@realcolormusic 9 жыл бұрын
Great tutorial! Just to mention: It will also work when the "class" is not in the "MainClass" but within the namespace curly braces or the project.
@minecraftcrafter999
@minecraftcrafter999 8 жыл бұрын
So is the main class also the base class of the other classes inside? just wondering
@relfirm2640
@relfirm2640 7 жыл бұрын
great tutorial as always! In video 10, animal class is placed outside the main class, but in this video class is placed inside the main class. What difference does this make?
12. How to program in C# - ENUMS - Beginner Tutorial
10:34
Brackeys
Рет қаралды 197 М.
How to program in Godot - GDScript Tutorial
58:10
Brackeys
Рет қаралды 893 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
8. How to program in C# - METHODS - Beginner Tutorial
17:08
Brackeys
Рет қаралды 316 М.
10. How to program in C# - CLASSES - Beginner Tutorial
18:58
Brackeys
Рет қаралды 314 М.
How to Program in C# - BASICS (E01)
11:48
Brackeys
Рет қаралды 1,5 МЛН
Best of CES 2025
14:50
The Verge
Рет қаралды 632 М.
HOW TO PROGRAM - Getting Started!
10:36
Brackeys
Рет қаралды 3 МЛН
13. How to program in C# - PROPERTIES - Beginner Tutorial
18:33
How to Program in C# - Classes (E07)
19:41
Brackeys
Рет қаралды 428 М.
Brackeys Game Jam 2020.2 - BEST GAMES!
11:31
Brackeys
Рет қаралды 551 М.