1. Class va Object
Zahro
Posted on October 11, 2024
a)C# da class nima?
Class – bu ob'ektlar uchun shablon bo'lib, field va methods kabi ma'lumotlar va xatti-harakatlarni o'z ichiga oladi. Har bir ob'ekt sinf asosida yaratiladi va o'ziga xos ma'lumotlarga ega bo'ladi.
b)Object nima?
Ob'ekt – sinfdan olingan konkret nusxa bo'lib, sinfdagi ma'lumotlar va funksiyalar bilan ishlash imkonini beradi. Sinf – shablon, ob'ekt esa uning amaliy ko'rinishidir.
c)Quidagi kodning natijasini ayting:
Class Car
{
public string Model;
public Car(string model)
{
Model = model;
}
}
Car myCar = new Car("Tesla");
Console.WriteLine(myCar.Model);
Natija: Tesla
💖 💪 🙅 🚩
Zahro
Posted on October 11, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
privacy Caught in the Crunch My Journey from Snacks to 2 Million Exposed Users Privacy
November 30, 2024