Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 762567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:24:53+00:00 2026-05-14T16:24:53+00:00

So I am coding this client/server program. This code is from the client side.

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T16:24:54+00:00Added an answer on May 14, 2026 at 4:24 pm

    You are passing a copy of the instance_ pointer to the function, not a reference to the variable. When you assign to instance_, you’re modifying a local variable, not the member variable with the same name.

    Change the function parameter to mpqs_sieve *&instance_.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the main code of my server program in C: int main(int argc,
I'm using visual studio to program this small TcpServer. It's really specific. The server
This is the code which i played, but each time i make a mistake
When I write client side code, I use HTML/CSS/JavaScript and lately jQuery to both
I have wrote a server program that can handle multiple client by using fork().
I'm coding a concurrent ATM application having a Client and a Server. I need
During coding I frequently encounter this situation: I have several objects ( ConcreteType1 ,
Using this question as the base is there an alogrithm or coding example to
In answering this question ( https://stackoverflow.com/questions/352317/c-coding-question#352327 ), it got me wondering... Is there any
Here's a coding problem for those that like this kind of thing. Let's see

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.