Class va Constructor
Mushtariy
Posted on October 11, 2024
a) Constructor nima?
Construktor – sinfdan obyekt yaratilganda avtomatik chaqiriladigan maxsus usuldir. U obyekning dastlabki qiymatini o'rnatish uchun ishlatiladi.
b)Quyidagi kodni to'ldiring:
class Animal
{
public string Name;
public Animal(string name)
{
Name = name;
}
}
Animal dog = new Animal("Dog");
Console.WriteLine(dog.Name);
💖 💪 🙅 🚩
Mushtariy
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
webdev Understanding HTTP, Cookies, Email Protocols, and DNS: A Guide to Key Internet Technologies
November 30, 2024