Тэги:
#unity #unity3d #tutorial #beginner #easy #function #and #settings #how #to #howto #learn #learning #course #series #tips #tricks #tutorials #workflow #fix #tip #technology #game #development #develop #games #programming #coding #basic #basics #C# #inheritance #derive #deriviation #base #class #classes #value #properties #fields #Unity_(Software) #Computer_Program_(Literature_Subject)Комментарии:
using System;
namespace MyFirstProgram
{
class Program
{
static void Main(string[] args)
{
// inheritance = 1 or more child classes recieving fields, methods, etc. from a common parent
Car car = new Car();
Bicycle bicycle = new Bicycle();
Boat boat = new Boat();
Console.WriteLine(car.speed);
Console.WriteLine(car.wheels);
car.go();
Console.WriteLine(bicycle.speed);
Console.WriteLine(bicycle.wheels);
bicycle.go();
Console.WriteLine(boat.speed);
Console.WriteLine(boat.wheels);
boat.go();
Console.ReadKey();
}
}
class Vehicle
{
public int speed = 0;
public void go()
{
Console.WriteLine("This vehicle is moving!");
}
}
class Car : Vehicle
{
public int wheels = 4;
}
class Bicycle : Vehicle
{
public int wheels = 2;
}
class Boat : Vehicle
{
public int wheels = 0;
}
}
bro code's unique weakness is spelling
Ответитьhocam KRALSIN
ОтветитьBRO!
Ответитьyou didnt explain base keyword..
ОтветитьThis is definitely Chad activity here. This needs to to studied.
Ответитьnice!
Ответитьgood video amogus
Ответитьwoot woot!
ОтветитьHow can you write Console .writeline when you write cw
ОтветитьPlease add an explanation on how constructors work in inheritance
ОтветитьBro you explain stuff in 4 min so i get it i its crazy pls keep doing these videos
ОтветитьWell explain inheritance. Love it.
ОтветитьAren't you supposed to mark the functions you want to override as "virtual"?
Or is that just a C++ thing and not present in C#?
Your knowledge and the way you are explaining it.. It's an amazing❤
ОтветитьAmazing video sir 🤗
ОтветитьI find your videos to be very helpful. Thanks a lot, I really appreciate it!
ОтветитьI like it, Picasso!
Ответитьteşekkür ederim
Ответитьnoice
Ответитьи ну да
ОтветитьI LOVE your 4 minutes videos, your channel is totally underrated
Ответитьabsolutely amazing thank you I needed this.
ОтветитьThanks bro
ОтветитьGreat explainations!
i see few do like this:
Vehicle boat = new boat();
and not like you do:
Boat boat = new boat();
why use
parentclass v = new childclass();
or
childclass v = new childclass();
Very well explained!
Ответитьתודה
ОтветитьThis is the best coding channel, it has giga chad
ОтветитьYou have good clear explained short videos.
Ответитьi like it concise
Ответитьlesson check😇
Ответитьthanks bro
Ответитьnice
Ответитьthanks
Ответитьawesome work, u rox
ОтветитьThanks for the video Bro.
ОтветитьThanks Bro!
Ответить