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 7576813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:00:50+00:00 2026-05-30T17:00:50+00:00

EDIT: I have no updated the question, whilst doing so I realized the scope

  • 0

EDIT:

I have no updated the question, whilst doing so I realized the scope of the question has completely changed, so I apologize for this. I am dealing with Threads so that static function has to be there. I have tried to abstract the Threading stuff out of the question as much as possible.

I am getting a pure virtual function call error, so I thought maybe I have the implementation wrong. Here is what I have:

class Base
{
    protected:
        virtual int f(void) = 0;
        static void baseFunction(void* param);
};

static void Base::baseFunction (void* param)
{
    Base *parent = (Base*) parameter;

    int i = parent->f();
}

class Derived : public Base
{
    private:
        int _memeber;
        int f(void);
};

int Derived::f(void)
{
    _member = 0;

    cout << "Derived _memeber is: " << _member << endl;

    return 0;
}

void main ()
{
    Derived d;

    d.baseFunction(d);
}

I need the function Derived::f(void) to have access to the Derived class members.

  • 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-30T17:00:51+00:00Added an answer on May 30, 2026 at 5:00 pm

    The definition looks fine, but I will hazard a guess that you’re calling the virtual function from the constructor or destructor of Base. In that case, virtual dispatch is done as if the dynamic type were Base, not Derived, and if the function is pure virtual then you get undefined behaviour.

    UPDATE: You also say “I am dealing with threads”. In that case, it’s possible that a data race could cause one thread to call the function while another is still constructing the object – again, giving undefined behaviour. You need to make sure all data accesses are correctly synchronised.

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

Sidebar

Related Questions

Edit: The below question was answered by this . I have a new updated
another django question. I have a edit form like this. Look at current_status in
(EDIT: Question changed.) I have a product with an installer which was built by
EDIT:Question Updated. Thanks Slott. I have a TCP Server in Python. It is a
Edit: I have solved this by myself. See my answer below I have set
EDIT i have something like this in a file: imagecolor=0 arrayimagecolorcopy=0 arrayimagecolorcopy3d=0 when i
EDIT: I have realized the source of my problem. I only have count information
Last Updated: 2009-08-11 2:30pm EDT A few days ago I posted this question about
Possible Duplicate: simple DataGridView refresh question I have a mainForm which has a DataGridView
This question is related to others I have asked on here, mainly regarding sorting

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.