LaunchCodeEducation / csharp-web-dev-curriculum

Hugo version of C# Unit 2
http://education.launchcode.org/csharp-web-dev-curriculum/
1 stars 5 forks source link

Chapter 5 Special Methods code example method uses wrong return type #67

Open matthewcreek opened 3 months ago

matthewcreek commented 3 months ago

Relevant link

Text code shows:

public override boolean Equals(object toBeCompared) {

   if (toBeCompared.GetType() != this.GetType())
   {
      return false;
   }

   Student s = toBeCompared as Student;
   return s.StudentId == StudentId;
}

C# return type should be bool and not boolean

Suggested change:

public override bool Equals(object toBeCompared) {

   if (toBeCompared.GetType() != this.GetType())
   {
      return false;
   }

   Student s = toBeCompared as Student;
   return s.StudentId == StudentId;
}