914-guruh talabasi O`ktamov Orziqul


Download 13.29 Kb.
Sana15.06.2023
Hajmi13.29 Kb.
#1478069
Bog'liq
Algoritm1


914-guruh talabasi O`ktamov Orziqul

17. Name va Age xususiyatlariga ega Animal nomli sinf yarating. Xususiyatlar uchun olish va o'rnatish bloklarini amalga oshiring. Hayvon chiqaradigan tovushni konsolga yozadigan MakeSound() usulini qo'shing.


using System;


class Animal{
public string Name;
public int age;
public virtual void MakeSound()
{
Console.WriteLine("Woof");
}
public void print(){
Console.WriteLine(Name);
Console.WriteLine(age);
}
}
class program {
static void Main(){
Animal I = new Animal();
I.Name = "It";
I.age = 2;
I.MakeSound();
I.print();
}
}
Download 13.29 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling