This is a question of what the original poster did here: Size of objects with multi-level / multiple inheritance . I hope this is true, and I could not find information on this topic.
Can anyone say why it is even legal to write such things:
#include <iostream>
using namespace std;
struct A{
int count = 0;
void operator ++(){count++;};
void operator ++(int){count++;};
void operator =(int){};
};
int main() {
A a;
++a;
a++;
a=5;
std::cout << a.count;
return 0;
}
Compiles with g++ -std=c++11 -Wpedantic ./operator_overload.cppno warning. (C ++ 11 is added for the initializer in the class).
Why is it allowed by the standard to return arbitrary types when objects of the return type of the source class are expected, maybe they are referenced.
, , , . , T, , , .
, void , . - , , ?