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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:15:27+00:00 2026-05-26T22:15:27+00:00

i dont know this solution… for example, my code is, class Bank { private

  • 0

i dont know this solution…

for example, my code is,

class Bank
{
 private :
  list < Client*> clientList;

}

class Client
{
private :
 list< Account*> accountList;

}

class account
{
private 
 list< string> statement;

}

oh, i want to access statement in bank class! and i think how to access its…

1) making list< Account*> getAccountList() method in Client class and list<string> getStatement() method in Account.

but why list is private? umm, may as well public?

2) making list access method(umm, for example, pop and push?) in All Class..

i got 2. but it’s terrible. I have a lot to do, and repeated similar function…

what is best way? it is way i never know?

  • 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-26T22:15:28+00:00Added an answer on May 26, 2026 at 10:15 pm

    The best solution is to have accessor methods in each class returning const reference to the list:

    class Account
    {
       private:
          list<string> statements;
    
       public:
          const list<string>& getStatements() const
          {
             return statements;
          }
    };
    

    This is better than public because the returned list reference is not modifiable.

    You could have methods returning const_iterator but then you must have methods on each class that return begin,end, and any other list operations you expect you might need.

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

Sidebar

Related Questions

according to this code i dont understand about NSClassFromString how did i know viewControllerName
This might sound weird, but when I open a solution that I dont know,
problem euler #5 i found the solution but i don't know why this first
I dont know where my error is in this mysql query $sql = INSERT
sorry for this question, but i dont know where to search for it, or
i dont know if this is possible, but i will explain what i want
I dont know whether this is possible but it would be great if there
Seems so basic, I can't believe I don't know this! I just need a
I don't know if this has been discussed. Let's say you are in a
I don't know why this bothers me so much, but when I create websites,

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.