All pastes #958983 Raw Edit

rickywh

public cpp v1 · immutable
#958983 ·published 2008-03-27 01:26 UTC
rendered paste body
using System;using System.Collections.Generic;using System.Collections.ObjectModel;namespace RickyTest{    public class Starter    {        public static void Main()        {            Cat ricky = new Cat("Ricky the Cat", 26);        }    }    public interface Animals    {        void EatFood();        void Breathing();    }    public class Cat: Animals    {        public string name;        public int age;        public int Age        {            get            {                return age;            }            set            {                if (Age > 25)                {                    Console.WriteLine("Invalid age, age not set.");                }                else                {                    age = value;                }            }        }        public Cat(string name, int age)        {            this.name = name;            this.Age = age;            Console.WriteLine("A new cat is just created");            Console.WriteLine(this.name + " is "+this.age+ " years old.");        }        public void EatFood()        {            Console.WriteLine(this.name+" eats some food.");        }        public void Breathing()        {            Console.WriteLine(this.name + " takes a few breaths of fresh air");        }    }}