Page 1 of 1

Exe1: Creating a Pet class Pet Class Priperties + Name string «get; private set>> + Owner : string «get; private set>> A

Posted: Tue Jul 12, 2022 8:20 am
by answerhappygod
Exe1 Creating A Pet Class Pet Class Priperties Name String Get Private Set Owner String Get Private Set A 1
Exe1 Creating A Pet Class Pet Class Priperties Name String Get Private Set Owner String Get Private Set A 1 (104.75 KiB) Viewed 39 times
Exe1: Creating a Pet class Pet Class Priperties + Name string «get; private set>> + Owner : string «get; private set>> Age int «get; private set>> + Description : string «get; private set>> + IsHouseTrained: bool «get; private set»> Methods + «constructor»> Pet (name: string, age: int, description : string) +ToString(): string Description of members: Fields: There are no fields. Properties: 1. The properties are self-explanatory Constructor: 1. public Pet (string name, int age, string description) - This constructor takes three arguments and assigns them to the appropriate fields. It also initi" alizes the fields owner to "no one" and isHoused Trained to false Methods: 1. public override string ToString() - This method returns a string fully describing this object. In your main method write the code to do the following: 1. Create four objects. You decide on the arguments 2. Create a List to store all the above objects. 3. Display all the items in the List