Тёмный

C# objects 🧍‍♂️ 

Bro Code
Подписаться 2 млн
Просмотров 44 тыс.
50% 1

C# object oriented programming tutorial example explained
#C# #objects #classes
using System;
namespace MyFirstProgram
{
class Program
{
static void Main(string[] args)
{
// object = An instance of a class
// A class can be used as a blueprint to create objects (OOP)
// objects can have fields & methods (characteristics & actions)
Human human1 = new Human();
Human human2 = new Human();
human1.name = "Rick";
human1.age = 65;
human2.name = "Morty";
human2.age = 16;
human1.Eat();
human1.Sleep();
human2.Eat();
human2.Sleep();
Console.ReadKey();
}
}
class Human
{
public String name;
public int age;
public void Eat()
{
Console.WriteLine(name + " is eating");
}
public void Sleep()
{
Console.WriteLine(name + " is sleeping");
}
}
}

Наука

Опубликовано:

 

2 июл 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 80   
@BroCodez
@BroCodez 3 года назад
using System; namespace MyFirstProgram { class Program { static void Main(string[] args) { // object = An instance of a class // A class can be used as a blueprint to create objects (OOP) // objects can have fields & methods (characteristics & actions) Human human1 = new Human(); Human human2 = new Human(); human1.name = "Rick"; human1.age = 65; human2.name = "Morty"; human2.age = 16; human1.Eat(); human1.Sleep(); human2.Eat(); human2.Sleep(); Console.ReadKey(); } } class Human { public String name; public int age; public void Eat() { Console.WriteLine(name + " is eating"); } public void Sleep() { Console.WriteLine(name + " is sleeping"); } } }
@BananaMan6763
@BananaMan6763 3 месяца назад
Radical!
@hingsing1
@hingsing1 Месяц назад
Thanks for pasting the code as well. Question- How come when you create the 'name' field within the Human class, the String has 'S' capitalized? I guess I'll find out later
@stapelton21
@stapelton21 Год назад
@Bro, Your Teaching skills and the examples you use are phenomenal. I've learned from nothing to something, All thanks to these tutorials.
@aarongarcia3296
@aarongarcia3296 Год назад
Awesome stuff! I’m learning C# through a book called C# players guide. It’s a very good book but your content is really solidifying some of the complex key terms
@ino1023
@ino1023 Год назад
Omg you're awesome! I struggled with OOP for 2 weeks in class and you just made this so simple. Thank you!
@ashrafsiddiq968
@ashrafsiddiq968 4 месяца назад
I couldn't agree more
@aziz-mv7qo
@aziz-mv7qo 2 года назад
wubba lubba dub dub!
@PixelPickleWaffle
@PixelPickleWaffle Месяц назад
Jhinga lala hoo hoo
@victorh.lopezchavez4229
@victorh.lopezchavez4229 Год назад
Nice video bro!! you help to understand in a good way how objects works!!
@osplace3309
@osplace3309 Год назад
Bro you are the best im trying to understand what is object for hours and you just made it clear, thak you so much!
@andrehufschmid
@andrehufschmid Год назад
Perfect. Very well explained with a good example.
@itsashhuby6781
@itsashhuby6781 Год назад
You explained this so well thank you!
@winstonsblues
@winstonsblues Месяц назад
Great breakdown, thanks bro.
@yavuzmarifet4528
@yavuzmarifet4528 Год назад
clear and smooth af, thank you
@peternydahl6150
@peternydahl6150 2 года назад
Simply great! Thanks a lot!
@willlywillly
@willlywillly Год назад
Bro are awesome. Been trying to figure OOP thinking it's rocket science but you have made it where even I can understand it. Actually I got a degree in rocket science but that doesn't make me a rocket scientist.
@hingsing1
@hingsing1 Месяц назад
great video! easy to understand bro
@LucParent905
@LucParent905 2 года назад
Great explanation, thanks again Bro
@orpheuscreativeco9236
@orpheuscreativeco9236 5 месяцев назад
Very straightforward and relatable 👍
@alexlungu7777
@alexlungu7777 3 года назад
Thank's for tutorials.
@CityRainee
@CityRainee 3 месяца назад
Love you bro, youre the best
@kenlee1159
@kenlee1159 2 года назад
THANKS FOR THE KNOWLEDGE BRO
@spartanranger
@spartanranger 2 года назад
Thanks for the video Bro.
@jhoonyschorles7396
@jhoonyschorles7396 8 месяцев назад
Best channel out there
@christophbruns8127
@christophbruns8127 2 года назад
Großartig!!
@wnyangani263
@wnyangani263 2 года назад
thank you so much for this
@azolirai
@azolirai 2 года назад
Thanks man!
@TheMontemayor
@TheMontemayor 8 месяцев назад
nice!
3 года назад
Thanks Bro!
@BantuBeya
@BantuBeya 3 месяца назад
bladah bang bro yeyeyeyye!
@EnglishVocabularyBooster
@EnglishVocabularyBooster Год назад
Wow!
3 года назад
Thank Bro!
@f5patch634
@f5patch634 9 месяцев назад
very useful!
@Ben-fn6wp
@Ben-fn6wp Год назад
Thank you Bro!!!
@joniviljami5833
@joniviljami5833 6 месяцев назад
thanks bro
@kyleengelbrecht4056
@kyleengelbrecht4056 Год назад
Nooooice
@s28177
@s28177 2 года назад
Thank you
@moneyonnet4848
@moneyonnet4848 8 месяцев назад
Bro code awesome
@budderrar5751
@budderrar5751 Год назад
noice
@FarhanAli-zb4iv
@FarhanAli-zb4iv 2 года назад
👍
@somyaranjanpatra4330
@somyaranjanpatra4330 3 года назад
👍🏻👍🏻👍🏻👍🏻👍🏻💯💯💯💯😍😍😍
@11anonymous6
@11anonymous6 Год назад
Aww, geez
@alexandregb566
@alexandregb566 11 месяцев назад
Evereyone's first project: "Hello world" My first project: Creating a human being from scratch
@marajohnson8856
@marajohnson8856 2 года назад
If I let coding make me nervous, then I can’t get schwifty
@noodleboi5053
@noodleboi5053 2 года назад
actual gigachad coder
@isaacchikoko8322
@isaacchikoko8322 4 месяца назад
Wubba libba dub dub!
@cleanlens
@cleanlens 5 месяцев назад
w
@krisve
@krisve Год назад
YOU ARE JUST WOWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
@ahmedhassan5783
@ahmedhassan5783 8 месяцев назад
done
@yashwantchoure
@yashwantchoure Год назад
"Wubba Lubba dub dub"
@pantsutsama
@pantsutsama 2 месяца назад
can you create tutorial vids like this using WinUI 2 or 3 UI frameworks?
@jdot6584
@jdot6584 3 года назад
Can you do a tutorial in C?
@katawaya8101
@katawaya8101 Год назад
Thanks for the tutorial, but is there a faster/more intuitive way to define an object with all of its properties? It seems like defining many objects with many different properties would be very time consuming. I'm more familiar with Python, where it's as easy as calling the class with all of the desired values for the properties.
@katawaya8101
@katawaya8101 Год назад
Nevermind! The answer is in the next video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-cAhh6pYkHPQ.html
@letitflow898
@letitflow898 11 месяцев назад
wubba lubba dubba
@edinbascausevic420
@edinbascausevic420 11 месяцев назад
I promote you to Dude! Thanks! Dude!!!🤣😂🤣😂
@MoreBilaINoFilter
@MoreBilaINoFilter 5 месяцев назад
wubba lubba dub dub
@thatsaquib
@thatsaquib Год назад
🗿
@Kozpont
@Kozpont 5 месяцев назад
Wubba Lubba Dub Dub!!!
@user-us3kg2jy5z
@user-us3kg2jy5z Год назад
if i want ro have my veriables private what do i do then?
@thibeaultdemulder8422
@thibeaultdemulder8422 Год назад
interaction
@Proviper666
@Proviper666 2 года назад
System this is a random coment to help Brintey Stasy
@whitedinamo
@whitedinamo 2 года назад
lesson check😇
@axlecode8598
@axlecode8598 Год назад
357
@the_dude_josh
@the_dude_josh 7 месяцев назад
Normally I put a random comment down below but why is it considered insecure to make them public? what would be the preferred solution?
@DonnyGGTV
@DonnyGGTV 6 месяцев назад
Im assuming having a second page for classes, and you can make them public on that page and just call them in to where you are woeking.
@Fork0
@Fork0 6 месяцев назад
Maybe a bit late to reply. In this case it doesn't matter, but usually fields should never be set to public, because they could be modified from anywhere in the program without the possibility for a validation of the newly assigned value. Take age for example: if you set it to public, anyone can just set it to whatever... 20, 60, 0, -123456. And then if your application relies on the value of age, it will have terrible consequences for the logic. Where as if you make the age private and also make 2 methods - void SetAge(int age) and int GetAge(), you can then add all the validation you want inside the SetAge method and throw exceptions if someone tries to add ages that make no sense, and use GetAge to actually get the value. Later on in this series you will learn more about this, but this is called Encapsulation (basically protection of data) and in C# you don't even need to do it with methods, but you'll learn to do it with properties (which pretty much mimic/replace those two methods i mentioned above). And as an additional info - fields are usually used for the internal logic of classes, whereas properties are exposed with public to the rest of the application so that people can use them instead of the fields.
@iamkingmatt2260
@iamkingmatt2260 3 месяца назад
Watching in 2024
@user-up7kv5si4x
@user-up7kv5si4x Год назад
random comment down below
@giuliafontana891
@giuliafontana891 Год назад
Random comment = new Random(10,12); Here it is your random comment. Thank you for simplifying concepts and making everything way easier!
@nikodemsomczynski
@nikodemsomczynski Год назад
random
@theelisan30
@theelisan30 4 месяца назад
random comment
@maximmasare7966
@maximmasare7966 5 месяцев назад
Thanks bro helped a lot. 🫡
@vortex5574
@vortex5574 2 года назад
Console.WriteLine("Random comment");
@alexiscoe1040
@alexiscoe1040 3 года назад
wubba lubba dub dub
@aziz-mv7qo
@aziz-mv7qo 2 года назад
u forgot the "!" at the end
Далее
C# constructors 👷
5:44
Просмотров 76 тыс.
C# classes 📦
4:54
Просмотров 67 тыс.
Meninas na academia
00:11
Просмотров 1,4 млн
Fundamental Concepts of Object Oriented Programming
9:16
If __name__ == "__main__" for Python Developers
8:47
Просмотров 391 тыс.
how Google writes gorgeous C++
7:40
Просмотров 833 тыс.
C# polymorphism 🎭
5:11
Просмотров 76 тыс.
Python Object Oriented Programming in 10 minutes 🐍
10:04
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
Every single feature of C# in 10 minutes
9:50
Просмотров 110 тыс.
Learn Any Programming Language In 3 Hours!
22:37
Просмотров 287 тыс.
5 JavaScript Concepts You HAVE TO KNOW
9:38
Просмотров 1,4 млн
How to Soldering wire in Factory ?
0:10
Просмотров 6 млн
Samsung laughing on iPhone #techbyakram
0:12
Просмотров 6 млн
📱магазин техники в 2014 vs 2024
0:41