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

stl & classes

Started by quasar3d Dec 10, 2002 at 3:03 PM 2 replies 300+ views
Original Post
quasar3d
quasar3d
How to make an array of classes using stl, whit the constructer and destructor called?
#include <vector>
#include <stdio.h>

using namespace std;

class Test
{
public:
	Test()
	{
		printf("Hi\n");
	}
	~Test()
	{
		printf("cya\n");
	}
	int l;
	int b;
};

void main()
{
	vector v(2);
}
 
this way doesn''t work. The constructer is called once and the destructor 3 timer. btw. I use msvc 6 and the stl files I got with it My Site
Stoffel
Stoffel
Note: plz use [ source ] and [ /source ] instead of [ code ] and [ /code ] so that you''re not thwarted by smileys.

Topic Locked

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

Sign in to reply to this topic.