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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:14:19+00:00 2026-05-29T15:14:19+00:00

I need to modify a really long program that was written by another programmer.

  • 0

I need to modify a really long program that was written by another programmer. Going through his code, you can see double pointers to C++ objects. I don’t understand why double pointers are used in this case, I think a single pointer would do the same thing. An example makes it more clear:

class A {
...
public:
   static B** b; //why double pointers here?
   ...
}


Class B {
...
public: 
   B(...)
   func1();
   func2();
}

We need to have a number of objects from B class, let say 5 objects (not a 2D array of objects). Once we create b, the code never tampers with *b. Only B’s functions are called by b[i]->func1(). So, since we don’t change pointers, I would guess we could do the same thing by defining static B* b;. Am I neglecting something?

  • 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-29T15:14:19+00:00Added an answer on May 29, 2026 at 3:14 pm

    Maybe the programmer needed an array of objects of type B or deriving from B (or simply not prevent that capability in future programs)? Because the objects deriving from B can be of different size, you cannot simply put them one after another in an array – hence the additional level of reference.

    In C++, if you are using boost library, this behavior can be relatively cleanly achieved by boost::ptr_vector or boost::ptr_array which will hide the uglyness of double pointers and prevent you from doing other accidental errors.

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

Sidebar

Related Questions

I need to modify a php search script so that it can handle multiple
I am having trouble understanding this code. All I really need is to modify
I need to modify the lm (or eventually loess ) function so I can
We have an issue where we need to modify keys for users that are
I have a row of data that I need to modify in a database,
Because sometimes, I really need a friend. I can think of the following tricks:
I need to modify a (xml-)file from Apache Ant. loadfile task allows to load
I need to modify the following MySQL statement to include information from a third
I need to modify the contents of the child rows of a hierarchical Infragistics
I need to modify an MSI file, and I'd like to do it in

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.