I have some confusion with this \"Can a object be passed as value to the copy constructor\" The compiler clearly rejects this, which means it is not possible. Can you help m
When a parameter is given by value, the compiler needs to copy an object first (in order create the instance which will be the argument). So for your copy constructor to be called, the compiler needs to make a copy of the object in advance.
Usually the copy constructors are defined in such a way:
Dummy(const Dummy& dummy)
{
// This is possible
}
This way, you don't ask for a separate copy of the object for the constructor, you just give a reference to an existing copy (and promise not to change that copy as well).