I know the difference between overloading and overriding.
overloading is doing add function another version with the same name.
and overriding is to change an original function to custom function with the same header.
Here I have two questions.
1. if I made a copy constructor.
1 2 3 4 5 6 7 8
|
template <class T>
class MyClass
{
.....
MyClass(const T& val) {....}
// is this overriding of copy constructor?
// or overloading of constructor?
}
|
2. If I made a copy operator
1 2 3 4 5 6
|
template <class T>
class MyClass
{
.....
T& operator=(const T& val) {....}
}
|
is this overriding of operator?
or overloading of operator?
I'm not sure it is overriding or overloading.
because I don't know an original operator's header.
but I think it is overriding.
cause It still exist as a default operator, like a default constructor.
even if I do not define an operator or constructor