DEV Community

asilbek ibragimov
asilbek ibragimov

Posted on • Edited on

2 2 2 2 2

1.Class va Object

1.Class va Object
TEST SAVOLLARI:
a)C# da class nima?
b)Object nima?
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

** TEST JAVOBLARI:**
a)Class – bu ob'ektlar uchun andoza yoki shablondir. 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 ob'ekt uchun alohida bo'ladi.

 b)Object – bu sinfdan yaratilgan konkret nusxadir. Ob'ekt 
 orqali sinfda aniqlangan ma'lumotlar va xatti-harakatlardan 
 foydalanish mumkin. Sinf deklaratsiyasi faqat shablondir, 
 ob'ekt esa sinfning amaliy hayotdagi ko'rinishidir.

 c) Output: "Tesla".
Enter fullscreen mode Exit fullscreen mode

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

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