Home > Back-end >  Novice consult overloaded operators
Novice consult overloaded operators

Time:01-13

Why this overload [] there is no ambiguity

CodePudding user response:

"C + + programming ideas"

CodePudding user response:

Const as a condition of overloaded functions

CodePudding user response:

references a white steamed bread on the second floor response:
const can be used as function overloading conditions

Const object can only use const method, object is const not const method can also be used

CodePudding user response:

reference tianfuplayer reply: 3/f
Quote: refer to the second floor a white steamed bun response:
const conditions can be used as function overloading

Const object can only use const method, can is a const object is not can also use a const method

Yes, non const object can call const method, can also call the const method, it's not conflict, followed cosnt method, shows that only through this method reads member variables of the class, can't change

CodePudding user response:

references a 5 floor white steamed bread response:
Quote: refer to the third floor tianfuplayer response:
Quote: refer to the second floor a white steamed bun response:
const can be used as function overloading conditions

Const object can only use const method, can is a const object is not can also use a const method

Yes, non const object can call const method, can also call the const method, it's not conflict, followed cosnt method, shows that only through this method reads the members of the class variables, not to change

Ok, then I ask the compiler to use priority which method
  • Related