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

The Archive Base Latest Questions

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

The problem I am having is that when my class CLimb runs its destructor,

  • 0

The problem I am having is that when my class CLimb runs its destructor, if member *parent is NULL I get an “Access violation writing location 0xcccccccc” error, after the destructor is called, but before the body is executed.

limb.h

class CLimb
{
public:
    CLimb(void);
    CLimb(CLimb *_parent);
    ~CLimb(void);

    float cut;
    float bone;
    float resistance;

    CLimb *parent;
};

limb.cpp

#include "limb.h"


CLimb::CLimb(void) :
    cut(0),
    bone(0),
    resistance(0)
{
    parent = NULL;
}

CLimb::CLimb(CLimb *_parent) :
    cut(0),
    bone(0),
    resistance(0)
{
    parent = _parent;
}

CLimb::~CLimb(void)
{
}

I was also wondering if I had 2 instances, limb01 and limb02, where limb02 is the parent of limb01, if limb02 is deleted limb01->parent now points to an incorrect address. How would I resolve this? Would I have to add a *child pointer as well?

  • 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-24T16:35:21+00:00Added an answer on May 24, 2026 at 4:35 pm

    Smart pointers are a solution. In particular, you can use a weak pointer here. A weak pointer is automatically reset when the reference count of the pointed-to object drops to zero (i.e. when it’s deleted).

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

Sidebar

Related Questions

I am having problem that when i am trying to submit the form by
Hi The problem am having is that I have multiple TreeView control and each
HI Guys, Here I am having problem that How can I post an image
The problem i'm having is that i've created a web service, and a windows
I'm trying to debug a cons script, and the problem I'm having is that
I am having the problem that I cannot select a specific XML node which
I am having a problem that just started happening in OS 3.1. I have
My problem is that I have a user that is having a problem displaying
I'm having the weird problem that after having javascript inject some dom-elements the css-rules
We are having problem with the server migration. We have one application that are

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.