Using C Class Make Sure Make Two Instances Pet Class Pet Able Walk Talk Also Able Set S Ag Q37124998

Using C# class

Make sure to make two instances of a pet class. The pet shouldbe able to walk and talk. You should also be able to set it’s AgeName, and Type (cat, dog). Make sure to set and show values foreach of the three properties (variables): Name, Type, Age. Makesure to execute the walk and talk (just display messages “I amwalking”, “I am talking.”).


Solution


using System;

class Pet
{
   private string name,type;
   private int age;
  
  
   //properties
   public string Name
   {
       get
       {
           returnname;
       }
       set
       {
           name =value;
       }
   }
   public

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.