Passing a constructor into a function.

Good evening everyone. I have an assignment I'm working on at the moment that is causing some trouble.

node->Push(ListNode("Sample"));

As you can see by the code sample there, I'm being asked to push an item on to a list by constructing it. This is all fine, however I'd like to pass in the memory address somehow instead. Is there any way this could be done?
Solved my own problem. Create new memory via new, then assign it with the value that the constructor was passed into.

u can do it like : node->Push(new ListNode("Sample"));
Topic archived. No new replies allowed.