How does the C++ compiler distinguish the uses of the * operator (pointer to or derefence operator or multiplication operator)?

Recently, I've returned to code in C++ and I've come up with this question: How can the compiler distinguish when used * as a pointer (MyClass* class) and when we use it as a multiply operator (a * b) or when is a dereferencing operator (*my_var)?

Read more here:

Content Attribution

This content was originally published by Pinnaker at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: