c++ Constructor | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

c++ Constructor

can someone tell me why my constructor isn't working. I want to be able to create a monster with an initial energy level https://code.sololearn.com/ctJXaXU74uk8/#cpp

27th Jun 2017, 8:29 PM
Bryan
1 Answer
+ 4
so close! Constructors go inside the class class classname { public: classname() {} // constructor void method(); // method (class function) private: int member; // member ( class data) }; edit: also: note what data type your constructor needs and what you passed to it. Hint; pointers
28th Jun 2017, 12:40 AM
jay
jay - avatar