I read somewhere that member functions in C++ are similar to regular functions but with an additional implicit this parameter.
As a result, I assumed that this software would be unable to discriminate between two functions.
However, the software executed successfully.
So, was the above statement incorrect?
#include <iostream>
class MyCls {
public:
void func(int i) {
std::cout << "Member" << i << std::endl;
}
};
void func(MyCls m, int i) {
std::cout << "Outside" << i << std::endl;
}
int main() {
MyCls m;
// Thought both would have same signature void func(MyCls, int). But program compiled.
m.func(4);
func(m, 5);
return 0;