My C++ overloading does not work as I expect it to:
#include "Node.h"
#include <iostream>
Node::Node()
{
cout << "1" << endl;
Node(Game(), 0.0);
}
Node::Node(double v)
{
cout << "2" << endl;
Node(Game(),v);
}
Node::Node(Game g, double v)
{
cout << "3" << endl;
numVisits = 0;
value = v;
game = g;
}
And the output from:
Node n(16);
cout << n.value << endl;
is zero when it should be sixteen.
What exactly am I doing wrong?