24. Class va Object

sunnat_qayumov

Sunnat Qayumov

Posted on October 14, 2024

24. Class va Object

a) Class ichida methodni qanday deklaratsiya qilasiz?

  1. Qaytarish turi(return Type)
  2. Metod nomi
  3. Parametrlari ro'yxati
  4. Method tanasi

    class ClassName
    {
        // Qaytarish turi, metod nomi va parametrlar
        public int MyMethod(int param1, string param2)
        {
            // Metodning tanasi
            return result;  // Qaytarish qiymati
        }
    }
    

*b) Quyidagi koddagi this kalit so'zining ma'nosini tushuntiring: *

class Person
{
    public string Name;
    public Person(string name)
    {
        this.Name = name;
    }
}
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
sunnat_qayumov
Sunnat Qayumov

Posted on October 14, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related