Operator overloading for user-defined types (part 1)
This lesson contains approximately 15 minutes of video content.
Introduction
First concepts
Calling an overloaded operator
Member or nonmember implementation?
Activity: Overloading the equal to operator for a user-defined type
Graded Playground Autograder
Activity Prompt:
In this problem, you will overload the equal to operator (
operator==
) for Student typed objects. We consider two student objects equivalent if each of their data members store identical values.
#include <iostream>
#include "student.hpp"
#include "utilities.hpp"
int main() {
}
#ifndef STUDENT_HPP
#define STUDENT_HPP
#include <string>
struct Student {
std::string first_name;
std::string last_name;
unsigned int uin;
};
#endif
#include "student.hpp"
#ifndef UTILITIES_HPP
#define UTILITIES_HPP
#include "student.hpp"
#endif
#include "utilities.hpp"
Submit is not supported in this site.