c++ - Overloading by private method with converted parameter -


With the following code, I'm getting: error: 'zero b :: add' Is . I'm surprised, but it's also frustrating to get ... I know that the add (int) method is private, but why the compiler can not find other solutions, i.e. one < Code> A object, like constructor is A (int) ?

Is this behavior defined by the C ++ standard?

Should the solution to this problem, or should I change the name of my personal method / apply the Peoples Idiom?

Thank you.

  struct A {A (int) {}}; Struct B {Add Zero (const A & amp;) {} Private: Zero plus (int) {}}; Int main () {B b; B.add (5); Return 0; }  

Because zero plus (int) is the best Mail to b.add (5)

You can get the problem using b.add (A (5)); .


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -