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

  • Home
  • SEARCH
  • 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 6998923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:28:25+00:00 2026-05-27T20:28:25+00:00

EDIT: It looks like I’m completely misinformed. Please close this thread. Gah. For the

  • 0

EDIT: It looks like I’m completely misinformed. Please close this thread. Gah.

For the record, the following compiles and works:

class ForeverAlone
{
private:
  int m_friends;
  HANDLE m_handle;

public:
  ForeverAlone()
  {
    m_handle = CreateThread(NULL, 0, &ForeverAlone::SadThread, reinterpret_cast<void*>(this), 0, NULL);
  }

  ~ForeverAlone()
  {
    if (m_handle != NULL)
      CloseHandle(m_handle);
  }

protected:
  static unsigned long WINAPI SadThread(void* param)
  {
    ForeverAlone* thisObject = reinterpret_cast<ForeverAlone*>(param);

    // is there any way for me to access:
    thisObject->m_friends;
  }
};

Original question: I have a static protected thread method, which I pass an object to. Can I somehow make the class friend itself so I can access its private 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-27T20:28:26+00:00Added an answer on May 27, 2026 at 8:28 pm

    All class methods, static or not, are automatically “friends” of the class. Friend is used to allow external functions and classes access to a class. The class is always its own “friend”.

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

Sidebar

Related Questions

Currently whenever the timestamp is echo'ed it looks like this function show_posts($userid){ $posts =
EDIT Looks like I figured it out - I had to call paginate after
Edit Looks like it was an issue on my part and my usage of
Second EDIT: Looks like my issue might be where the date is set from
Take a look at my code example at js bin: http://jsbin.com/iritep/3/edit I'd like to
EDIT - The code looks strange here, so I suggest viewing the files directly
EDIT: OK, I believe the following solutions are valid: Use the jQuery AOP plugin.
EDIT: This post was originally specific to ASP.NET, but after thinking about it I'm
I'd like to be able to do the following: num_intervals = (cur_date - previous_date)
Forgive me if this is a slight mis-use of the system, but I'd like

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.