I'm learning Virtual Functions in C++ especially in terms of Base/Derived classes. The website I'm referring at the moment is learncpp.com.
My question is about this small snippet of code where in the class Animal, the constructor Animal() is being derived form m_strName (which is a variable in the same class). How is this possible? also, is it possible to have constructors be derived from any class (if any) whatsoever?
#include <string>
class Animal
{
protected:
std::string m_strName;
Animal(std::string strName)
: m_strName(strName)
{
}
public:
std::string GetName() { return m_strName; }
const char* Speak() { return "???"; }
};