Skip to main content
GameDev.net gamedev.net
🔒 Locked

Constructors that takes multiple arguments

Started by endasil Jan 4, 2004 at 9:01 AM 1 replies 400+ views
Original Post
endasil
endasil
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; };
EndasilVisit my site, try my gameswww.dragonrealmsoftware.comI need more beta tester for my game! Check out http://www.dragonrealmsoftware.com
Chacha
Chacha
Foo foo[3] = { Foo(w, h), Foo(w, h), Foo(w, h) };
endasil
endasil
Thank you very much for your help!
EndasilVisit my site, try my gameswww.dragonrealmsoftware.comI need more beta tester for my game! Check out http://www.dragonrealmsoftware.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.