DEV Community

Cover image for Class and Objects
umida5
umida5

Posted on

Class and Objects

                     Class 
Enter fullscreen mode Exit fullscreen mode

Class - bu malulotlarni saqlash uchun andoza yoki shablon.Sinflar
ma'lumo, xatti-harakatlar va xususiyatlardan iborat.Ular sinf ichida
aniqlanadi va har bir ob'ekt uchun alohida bo'ladi.

class SinfNomi
{
    // Fields (ma'lumotlar)
    // Methods (xatti-harakatlar)
}
Enter fullscreen mode Exit fullscreen mode

Sinf ichida fields(maydonlar) ma'lumotlarni saqlash uchun yaratiladi,
xatti-harakatlarni belgilash uchun esa methods(usullar) e’lon qilinadi.

class Avtomobil
{
    // Fields (maydonlar)
    public string model;
    public string rang;
    public int yil;

    // Methods (usullar)
    public void Yurish()
    {
        Console.WriteLine(model + " harakatlanmoqda.");
    }
}
Enter fullscreen mode Exit fullscreen mode
                  Object
Enter fullscreen mode Exit fullscreen mode

Object - bu sinfdan yaratilgan nusxa.Ob'ekt orqali class da yaratilgan
ma'lumotlar va xatti-harakatlardan foydalanish mumkin.

SinfNomi ob'ektNomi = new SinfNomi();
Enter fullscreen mode Exit fullscreen mode
  • ob'ekt sinfdagi barcha maydonlarga va usularga ega bo'ladi.
  • ob'ekt o'ziga ma'lumotlar(properties) saqlaydi.

Billboard image

Imagine monitoring that's actually built for developers

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (0)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay