about c++ conversion : no known conversion for argument 1 from ‘[some_class]' to ‘[some_class]&’

You are passing a temporary Base object here:

b.something(Base());

but you try to bind that to a non-const lvalue reference here:

void something(Base& b){}

This is not allowed in standard C++. You need a const reference.

void something(const Base& b){}

When you do this:

Base c;
b.something(c);

you are not passing a temporary. The non-const reference binds to c.


In the first case you attempt to pass a (non-const)reference to a temporary as argument to a function which is not possible. In the second case you pass a reference to an existing object which is perfectly valid.