My C++ overloading does not act as I assume it should:
#include \"Node.h\"
#include
Node::Node()
{
cout << \"1\" << endl;
Node::Node(double v)
{
cout << "2" << endl;
Node(Game(),v); // 1
}
value
upon which the single argument constructor is instantiated. You also need to understand that this temporary object is entirely different from the original constructing object.However you can extend the life time of this temporary object by a const reference i.e.,
Node::Node(double v)
{
cout << "2" << endl;
const Node& extendTemporay = Node(Game(),v);
value = extendTemporary.value ; // Just trivial example;
// You can simply do it by value = v;
}