This topic is now archived and is closed to further replies.


Constructors that takes multiple arguments

Recommended Posts

if i have a class with a constructor taking two arguments, how do i set the values for it? With a constructor taking one argument, i can do it like this: class TestClass { public: TestClass(int value) { a = value} private: int a; }; TestClass Test[5] = {1,4,7,4,9} With this form of class, the same does not work, how do i send it values at initialization when the constructor takes multiple arguments? Like this one: class B { B(int W, int H) { Width = W; Height = H } private: int Width, Height; };

Share this post

Link to post
Share on other sites