[ create a new paste ] login | about

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

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

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

class str_caller
{
private:
	str_manager *str_manager_array;
	unsigned int max;
	
public:
	str_caller(unsigned int max, std::string a, std::string b, const char* b0, const char* b1, const char* b2, const char* b3) : 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, b);
	}
};

int main()
{
	std::string b0 = "a", b1 = "b", b2 = "c", b3 = "";
	unsigned int x0 = 1, x1 = 1, x2 = 10, x3 = 10, x4 = 5, x5 = 200, x6 = 500;
	str_caller str_data = str_caller(x5, "a", "b", b0.c_str(), b1.c_str(), b2.c_str(), b3.c_str());
	
	return 0;
}


Output:
1
Segmentation fault


Create a new paste based on this one


Comments: