/***************************************************
Required Output:
My dog's name is Roofus.
My cat's name is Felix.
****************************************************/
using static System.Console;
class CreatePets1
{
static void Main()
// Create two Pet objects: myDog and myCat
Pet myDog = new Pet();
Pet myCat = new Pet();
// Set their Name Properties to "Roofus" and "Felix"
myDog.Name = "Roofus";
myCat.Name = "Felix";
// Display their names to the terminal
WriteLine("My dog's name is " + myDog.Name);
WriteLine("My cat's name is " + myCat.Name);
}
class Pet
// Create the Backing Field for the pet's name
private string _name;
// Constructor - Do nothing with this. You will learn about it later.
public Pet()
_name = "";
// Name property
public string Name
// Create the get accessor here
get
return _name;
set
_name = value;
// Create the set accessor here