So I am coding this client/server program. This code is from the client side. The client has an instance of an object
mpqs_sieve *instance_;
The reason I make it as a pointer is, that mpqs_sieve only has a constructor that takes 3 arguments, and I want to instantiate it at a later point in time.
The client first gets some data from the server, and uses this to instantiate instance_. After this, it will request some more data, and upon receiving this (these are three coefficients for a quadratic polynomial), it should set these in the instance_ object. However upon calling a member function of instance_, I get an access violation on one of the members of instance_ within that function call.
I posted my code here: on pastebin, and I get the error on line 100. The call comes from line 71, and before that line 21. Here's an excerpt:
class client_protocol {
public:
static std::string parse_message(
network_message& msg, mpqs_sieve *instance_)
{
// ...
return set_mpqs_data(m.substr(i+1), instance_);
}
private:
static std::string set_mpqs_data(
std::string data, mpqs_sieve *instance_)
{
instance_ = new mpqs_sieve(n, M, FB_count);
// ...
}
};
Any ideas to solve this?