Jump to content
  • Advertisement


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


Constructors that takes multiple arguments

This topic is 5307 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!