using System;
namespace Oop
{
public class Animal
{
string name;
string sound;
static int countanimals=0;
public Animal()
{
name = "No name assigned";
sound = "null";
countanimals++;
}
public void setName(string n)
{
name = n;
}
public void getName()
{
Console.WriteLine("Name:{0}", name);
}
public void setSound(string s)
{
sound = s;
}
public void getSound()
{
Console.WriteLine("Sound:{0}", sound);
}
public static void countAnimals()
{
Console.WriteLine("Number of Animals are:{0}", countanimals);
}
}
class Program
{
static void Main(string[] args)
{
Animal dog = new Animal();
dog.setName("Bailey Bailey Bailey");
dog.setSound("Woof Woof Woof");
dog.getName();
dog.getSound();
Animal.countAnimals();
Console.ReadKey();
}
}
}
namespace Oop
{
public class Animal
{
string name;
string sound;
static int countanimals=0;
public Animal()
{
name = "No name assigned";
sound = "null";
countanimals++;
}
public void setName(string n)
{
name = n;
}
public void getName()
{
Console.WriteLine("Name:{0}", name);
}
public void setSound(string s)
{
sound = s;
}
public void getSound()
{
Console.WriteLine("Sound:{0}", sound);
}
public static void countAnimals()
{
Console.WriteLine("Number of Animals are:{0}", countanimals);
}
}
class Program
{
static void Main(string[] args)
{
Animal dog = new Animal();
dog.setName("Bailey Bailey Bailey");
dog.setSound("Woof Woof Woof");
dog.getName();
dog.getSound();
Animal.countAnimals();
Console.ReadKey();
}
}
}
Comments
Post a Comment