[ create a new paste ] login | about

Link: http://codepad.org/8tAeoWnI    [ raw code | output | fork ]

C++, pasted on Nov 3:
#include <iostream>
#include <string>

class str_manager
{
private:
	std::string a;
public:
	str_manager(std::string a_in) {
		a = a_in;
	}
};

class str_caller
{
private:
	str_manager *str_manager_array;
	unsigned int max;
	
public:
	str_caller(unsigned int max, std::string a, const char* b0) : max(max)
	{
		str_manager_array = (str_manager*)calloc(max, sizeof(str_manager));
		for(unsigned int i = 0; i < max; i++) str_manager_array[i] = str_manager(a);
	}
};

int main()
{
	std::string b0 = "a";
	unsigned int x0 = 1;
	str_caller str_data = str_caller(x0, "a", b0.c_str());
	
	return 0;
}


Output:
1
Segmentation fault


Create a new paste based on this one


Comments: