DEV Community

Mushtariy
Mushtariy

Posted on

1 1 2 1 1

Value va Reference Type

a)Quyidagi kodning natijasini tushuntiring.

int a = 100;
int b = a;
b = 200;
Console.WriteLine(a);
Enter fullscreen mode Exit fullscreen mode

Javob 100, chunki a ning qiymati 100 va u o'zgarmadi faqat a ning qiymati b ga ham tenglandi

b) Quyidagi kodni natijasini ayting va tushuntiring.

class Car
{
    public string Model;
}
Car car1 = new Car();
car1.Model = "BMW";
Car car2 = car1;
car2.Model = "Audi";
Console.WriteLine(car1.Model);

Enter fullscreen mode Exit fullscreen mode

Javob: BMW chunki car1 BMW ga teng va u o'zgarmadi faqat car2 ga uning nusxasi tenglandi string tiplarini qiymati hechqachon o'zgarmaydi.

Top comments (0)

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay