1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Dynamic class overloads

Discussion in 'C++' started by sinfultom, Sep 1, 2010.

  1. sinfultom

    sinfultom New Member

    Sep 1, 2010
    Likes Received:
    Trophy Points:
    Hi there, I'm new to the forum so please be kind :)

    I've created a class called node that has a standard constructor and an overload that uses an int as an argument.

    class node
    node(int inputs);
    I can create an dynamic array of nodes with
    node *nodes;
    node = new nodes[number];which works very nicely. But now I want to setup the nodes using the overloaded constructor. I tried
    node = new nodes(width)[number];but that just created a whole load of errors. I realise I could make another function in the node class that could make the changes the overload would've done but I want this to be as neat as possible. Any help would be greatly appreciated.
    Thank you, Tom

Share This Page