Socha, David F wrote:
> if i use this code later on in a program and create a new node dynamically using code such as:
>
> node* root = new node(5);
>
> that should alocate the memory, call the constructor, and set the data portion of the node to 5.
>
> the constructor that is called is the one that will assign a value to data not the default constructor that does nothing, right?
Of course. If the compiler does not complain, then it found a matching
overloaded function (constructor). It would give an error, if it cannot
find a matching function. Try node *root = new node(5,5); to see, what
error would you get.
Anyway, why don't you use built-in C++ storage? It already has vectors,
lists, etc.
--
Greetings,
Balázs
|