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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:04:46+00:00 2026-06-10T03:04:46+00:00

In order to implement my own iterators, I would like to implement something like

  • 0

In order to implement my own iterators, I would like to implement something like this :

class MyClass :
{
    public:
        class MyIterator1 {;};
        class MyIterator2 {;};
        class MyIterator3 {;};
};

As these iterators will share some common behaviours, it will be better if they inherit from a base iterator called MyBaseIterator. But I consider MyBaseIterator as a detail of implementation : the user should not use MyClass::MyBaseIterator directly. Is the following OK :

class MyClass :
{
    protected:
        class MyBaseIterator;
    public:
        class MyIterator1 : public MyBaseIterator {;};
        class MyIterator2 : public MyBaseIterator {;};
        class MyIterator3 : public MyBaseIterator {;};
};

Will the member derived from MyBaseIterator be available to the user even if MyBaseIterator is protected ?

  • 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-06-10T03:04:48+00:00Added an answer on June 10, 2026 at 3:04 am

    Yes, unless the user extends MyClass. To completely deny access, make it private. Also, not that you can only do anything meaningful with MyBaseIterator inside the class (guess you already know that).

    Also, to completely hide implementation details, you should look into the pimpl idiom.

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

Sidebar

Related Questions

I was wondering how exactly does TCP implement in-order delivery. lets say this is
I wanted to implement a default sort order in my domain class and immediately
How do i implement a java comparator class which can sort the order of
I want to implement my own dynamic memory management system in order to add
As per this article , I've extended the System.Windows.Forms.WebBrowser class to implement custom error-handling.
I would like to create a map that uses a class as a key
This is straight from the Java Docs : This class and its iterator implement
Similar to how lambda expressions with free variables work I would like to implement
I read raw socket tutorial in order to implement my own bridge (i capture
I need to implement a plugin architecture within c#/.net in order to load custom

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.