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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:42:25+00:00 2026-05-11T02:42:25+00:00

This problem involved me not knowing enough of C++. I am trying to access

  • 0

This problem involved me not knowing enough of C++. I am trying to access a specific value that I had placed in the Heap, but I’m unsure of how to access it. In my problem, I had placed a value in a heap from a data member function in an object, and I am trying to access it in another data member function. Problem is I do not know how, and I had searched examples online, but none were what I needed as they were all in int main() and were not specifically what I needed.

In the first data member function, I declare the value I want to be sent to the Heap; Here’s an example of what my first data member function.

void Grid::HeapValues() {     //Initializing Variable     value = 2; //The type is already declared      //Pointers point a type towards the Heap     int* pValue = new int;      //Initialize  an a value of in the Heap     *pValue = value; } 

And in data member function This is what want:

void Grid::AccessHeap() {     //Extracting heap:     int heap_value = *pValue; //*pValue does not exist in this function     cout << heap_value; //Delays the value 2, which is found                         //in the first data member function } 

I feel foolish for asking, but I am unable to find the answers and do not how. Does anyone know how to access a value from the heap in a simple way? And I would need it to be able to access in more then two data member function.

  • 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. 2026-05-11T02:42:25+00:00Added an answer on May 11, 2026 at 2:42 am

    pValue needs to be a member-variable of the class Grid.

    class Grid {   private: int* pValue;   public: void HeapValues();           void AccessHeap(); }; 

    Now the member-variable pValue is accessible from any member-function of Grid.

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

Sidebar

Related Questions

I don't have any significant experience with C++ but recently had to be involved
Not a 'pure' programming question, but since it is deeply involved in programming theory,
This problem crops up every now and then at work. Our build machine can
This problem occurred during daylight saving time change. After the change occurred, we've noticed
This problem has been solved thanks to your suggestions. See the bottom for details.
This problem has been kicking my butt for a few days now. I have
This problem pertains to Java By using RandomAccessFile I intend to be able to
Consider this problem: I have a program which should fetch (let's say) 100 records
I'm getting this problem: PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable
I come across this problem when i am writing an event handler in SharePoint.

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.