Skip to content

Instantly share code, notes, and snippets.

@shuhaowu
Last active August 22, 2022 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuhaowu/2784ed5d29870fcda6ed791667d24448 to your computer and use it in GitHub Desktop.
Save shuhaowu/2784ed5d29870fcda6ed791667d24448 to your computer and use it in GitHub Desktop.
#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;
}
$ 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