Difference between operator and function in C++?

后端 未结 8 602
夕颜
夕颜 2021-02-01 08:31

I could use some help understanding the following in C++, particularly the difference between an operator and a function:

  • What is an operator?
  • What is a f
8条回答
  •  终归单人心
    2021-02-01 08:45

    Here are some differences between an operator and a function:

    1. An operator does not push its parameters onto the stack, but a function pushes its parameters onto the stack.

    2. The compiler knows about the operation of the operators, but is not aware of the output of the function. Said a different way, the action of the operator is defined at compilation time and that of a function is defined at the runtime.

提交回复
热议问题