DEV Community

Mushtariy
Mushtariy

Posted on

Class va object

a)C# da class nima?
Class - bu obyektlar uchun shablondir. Classni ichida har bir obyekt tekshiriladi va har bir sinfdagi obyekt uchun alohida bo'ladi.
b)Object nima?
Object - sinfda yaratilgan nusxa. Obyekt orqali sinfda aniqlangan ma'lumotlardan foydalanish mumkin.
c)Quyidagi kodning natijasini 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

Natija:Tesla

Top comments (3)

Collapse
 
sunnat_qayumov profile image
Sunnat Qayumov

nma bu

Collapse
 
sunnat_qayumov profile image
Sunnat Qayumov

bomaptiiiii👎🏾

Collapse
 
asilbek_ibragimov_a0c27cc profile image
asilbek ibragimov

бомапти👎🏾