Hi,
Can you please help me with my assignment.I coded it and it runs I just need someone to help me a bit.
The behaviour of monekys and human beings are Similar (Breeding and breathing are Identical and walking ,communication and eatng are common but non-identical)here is my code:
as you can see breething and breeding have the same output when their method is called.Is there any way not to re-type the breed and breath in one of the HumanBeings or Moneky???Can you please provide me the code for that?
Can you please help me with my assignment.I coded it and it runs I just need someone to help me a bit.
The behaviour of monekys and human beings are Similar (Breeding and breathing are Identical and walking ,communication and eatng are common but non-identical)here is my code:
Code:
using System; using System.Collections.Generic; using System.Text; namespace Project1 { public abstract class abstractAnimalsComonBehaviour:Animals { public abstract void breeding(); public abstract void breathing(); public abstract void walking(); public abstract void eating(); public abstract void communicating(); } } using System; using System.Collections.Generic; using System.Text; namespace Project1 { public interface Animals { void breathing(); void breeding(); void walking(); void communicating(); void eating(); } } using System; using System.Collections.Generic; using System.Text; namespace Project1 { class HumanBeings:abstractAnimalsComonBehaviour { public override void walking() { Console.WriteLine("walking"); } public override void eating() { Console.WriteLine("fork and knife"); } public override void communicating() { Console.WriteLine("talking"); } public override void breeding() { Console.WriteLine("Breed"); } public override void breathing() { Console.WriteLine("Breath"); } } } using System; using System.Collections.Generic; using System.Text; namespace Project1 { class Monkey : abstractAnimalsComonBehaviour { public override void walking() { Console.WriteLine("Jumping"); } public override void eating() { Console.WriteLine("using hands"); } public override void communicating() { Console.WriteLine("scream"); } public override void breeding() { Console.WriteLine("Breed"); } public override void breathing() { Console.WriteLine("Breath"); } } } using System; using System.Collections.Generic; using System.Text; namespace Project1 { class Program { static void Main(string[] args) { Animals Bobo = new Monkey(); Bobo.eating(); Bobo.breathing(); Animals John = new HumanBeings(); John.eating(); John.breeding(); } } }
Comment