DEV Community

Sunnat Qayumov
Sunnat Qayumov

Posted on • Edited on

2 2 2 2 2

1. Class va Object

a) C# da class nima? Bu obyektlar uchun shablon kod. Sinf ma'lumotlar(field) va xatti-harakatlar(methods, properties) to'plamidan iborat. Bu ma'lumotlar va xatti-harakatlar sinf ichida aniqlanadi va sinfdan yaratilgan har bir obyekt uchun alohida bo'ladi.

b) Object nima? Obyekt – bu sinfdan yaratilgan nusxadir. Obyekt orqali sinfda aniqlangan ma'lumotlar va xatti-harakatlardan foydalanish mumkin. Obyekt sinfning amaliy hayotdagi ko'rinishidir.

*c) Quyidagi kodni natijasi ayting: *

class Car
{
    public string Model;
    public Car(string model)
    {
        Model = model;
    }
    car myCar = new Car("Tesla");
    Console.WriteLine(myCar.Model);
}
Enter fullscreen mode Exit fullscreen mode

Output: "Tesla".

Top comments (1)

Collapse
 
asilbek_ibragimov_a0c27cc profile image
asilbek ibragimov

маладес мужик

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay