Last active
August 22, 2022 17:54
-
-
Save shuhaowu/2784ed5d29870fcda6ed791667d24448 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
struct A { | |
int a; | |
const A operator*(const A& other) const { | |
std::cout << "A1: " << this->a << " A2: " << other.a << "\n"; | |
return *this; | |
} | |
}; | |
int main() { | |
A T{1}; | |
A b{2}; | |
T* b; | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ g++ a.cpp && ./a.out | |
A1: 1 A2: 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment