DEV Community

asilbek ibragimov
asilbek ibragimov

Posted on • Edited on

7.Class va Constructor

7.Class va Constructor
a) Cunstructor nima?
b) Quyidagi kodni to'ldiring:

     class Animal
     { 
          public string Name;
          public Animal(______)
          { 
               Name = name;
          }
     }
     Animal dog = new Animal("Dog");
     Console.WriteLine(dog.Name);
Enter fullscreen mode Exit fullscreen mode

** Test Javoblari**

a) Constructor — bu sinfning birinchi marta foydalanilganda avtomatik ravishda chaqiriladigan konstruktor. U faqat bir marta chaqiriladi va odatda sinfning statik a'zolarini boshlash uchun ishlatiladi.
b) Javob: "name" ;

Top comments (0)