//public Dog(int chipRegistrationNumber, SimpleDate dateOfBirth, // string name) : base(chipRegistrationNumber, dateOfBirth, name) //{ // LastWalkDate = null; // Price = GetPrice(); //} /// <summary> /// Retrieve information about this dog /// /// Note: Every class inherits (automagically) from the 'Object' class, /// which contains the virtual ToString() method which you can override. /// </summary> /// <returns>A string containing the information of this animal. /// The format of the returned string is /// "Dog: <ChipRegistrationNumber>, <DateOfBirth>, <Name>, <IsReserved>, <LastWalkDate>" /// Where: IsReserved will be "reserved" if reserved or "not reserved" otherwise. /// LastWalkDate will be "unknown" if unknown or the date of the last doggywalk otherwise. /// </returns> public override string ToString() { string walked = LastWalkDate.ToString(); if (walked == "01/01/1980" || walked == null) { walked = "Please Walk!"; } return(base.ToString() + ", " + walked); }
/// <summary> /// Retrieve information about this dog /// /// Note: Every class inherits (automagically) from the 'Object' class, /// which contains the virtual ToString() method which you can override. /// </summary> /// <returns>A string containing the information of this animal. /// The format of the returned string is /// "Dog: <ChipRegistrationNumber>, <DateOfBirth>, <Name>, <IsReserved>, <LastWalkDate>" /// Where: IsReserved will be "reserved" if reserved or "not reserved" otherwise. /// LastWalkDate will be "unknown" if unknown or the date of the last doggywalk otherwise. /// </returns> public override string ToString() { string toAppend = "unknown"; if (LastWalkDate != null) { toAppend = LastWalkDate.ToString(); } return("Dog: " + base.ToString() + ", " + toAppend); }
public override string ToString() { string lastWalkDate; if (LastWalkDate == null) { lastWalkDate = "Unknown"; } else { lastWalkDate = LastWalkDate.ToString(); } return("Dog: " + base.ToString() + ", " + lastWalkDate + ", " + Price); // Hoeft geen Price.ToString() dit is "redundant" dat houdt in dat de compiler al weet dat het hier om een string gaat }
/// <summary> /// Retrieve information about this dog /// /// Note: Every class inherits (automagically) from the 'Object' class, /// which contains the virtual ToString() method which you can override. /// </summary> /// <returns>A string containing the information of this animal. /// The format of the returned string is /// "Dog: <ChipRegistrationNumber>, <DateOfBirth>, <Name>, <IsReserved>, <LastWalkDate>" /// Where: IsReserved will be "reserved" if reserved or "not reserved" otherwise. /// LastWalkDate will be "unknown" if unknown or the date of the last doggywalk otherwise. /// </returns> public override string ToString() { string info; string LastWalk; if (LastWalkDate == null) { LastWalk = "unknown"; } else { LastWalk = LastWalkDate.ToString(); } info = "Dog: " + base.ToString() + LastWalk; return(info); }
public override string ToString() { string lastWalkDateString; if (LastWalkDate == null) { lastWalkDateString = "Unknown"; } else { lastWalkDateString = LastWalkDate.ToString(); } string info = "Dog: " + base.ToString() + ", " + lastWalkDateString; return(info); }
public override string ToString() { string walk; if (LastWalkDate == null) { walk = "Please Walk!"; } else { walk = LastWalkDate.ToString(); } return("Dog: " + base.ToString() + ", " + walk); }