...

/

Quiz on Operator Overloading

Quiz on Operator Overloading

Here is a quiz to test your understanding of the concepts related to operator overloading.

We'll cover the following...
Technical Quiz
1.

Consider the following code:

struct Duration {
    int hour;
    int minute;
    bool opEquals(Duration rhs) const {
        return hour == rhs.hour; 
    }
}

void main() {
    assert(TimeOfDay(20, 30) == TimeOfDay(20, 21));
}

Will the assert pass?

A.

Yes

B.

No


1 / 5