I'm trying to implement a function which return a class object using its constructor. that class object as only constructor with parameters and there isnt any default constructor (cuz i dont need it). when I try to return that class object - that error comes up..
Base.cpp
Derived Base::operator+ (){ return Derived(*this); // no matching function for call to ‘Derived::Derived(Derived)’ }
Base.h
virtual Derived operator+ ();
Derived.h //Constructors:
Derived(Base &b);
Derived(Derived &d);
1. what can I do in order to fix that error?
2. whats the diffrence between declaration (const Derived &) and (Derived &)?
Thanks