SHARE
TWEET

delegating_constructors

SRD May 27th, 2020 1,117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Node::Node()
  2. {
  3.     do_something();
  4. }
  5.  
  6. /* What is the proper syntax here to call the above constructor, and have initialization lists. */
  7. Node::Node(const unsigned int idx, std::shared_ptr<ioctl_node_t> io) : Node(), index(idx), node(io)
  8. {  
  9.     do_more_stuff();
  10. }  
  11.  
  12. /* The above results in the following error.
  13. node.cc:26:106: error: mem-initializer for ‘Node::index’ follows constructor delegation
  14.  Node::Node(const unsigned int idx, std::shared_ptr<ioctl_node_t> n) : Node(), index(idx), node(n)
  15. */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top