DEV Community

Xojimurodov
Xojimurodov

Posted on

Classes and Objects

Image description
1) Class - bu shablondir. Class yani sing o'z ichida methods, malumotlar va xatti-xarakatlardan iborat.

class Avtomobil
{
public string model;
public string rang;
public int yil;
public void Yurish()

public void Yurish()
{
Console.WriteLine(model + " harakatlanmoqda.");
}

2) Object - bu konkret nusxadur. Object yordamida topilgan malumotlar va xatti-xarakatlarni ishlatish mumkin.

Object yaratish - Avtomobil avtomobil1 = new();

3) Javobi - Tesla.

Top comments (0)