Dynamic class overloads

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

  1. sinfultom

    sinfultom New Member

    Joined:
    Sep 1, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
    {
    public:
    node(void);
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice