Ever wanted to compare two Dogs? Well now you can!
Dog(const int age = 1, const string name = "Un-named")
m_age = age;
m_name = name;
//Here's where it gets interesting...
bool operator ==(const Dog rhs); //rhs = right-hand side
bool Dog::operator ==(const Dog rhs)
return (m_age == rhs.m_age && m_name == rhs.m_name);
Dog spike(3, "Spike"), brownie(7, "Brownie");
//Notice that brownie is on the right-hand side
//of the == operator
bool dogs_are_equal = (spike == brownie); //false
Disclaimer: I have absolutely no connection with Blizzard or the Overwatch team. I am simply a fan of Overwatch.
Hello, class. My name is Hanzo Shimada, and I am here to teach you about programming. But, before I do that, I would like to give you some back story.
After reuniting with my brother Genji, I decided to do something with the spare time I gained from nolonger praying at the alter for my brother. I pondered for many, many nanoseconds before deciding on following in my cousin’s friend’s older brother’s footsteps. I decided to become a programmer.
Next time on Hanzo Programs: Idk yet, structure is boring. Probably something to do with programming.