Protected member access problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rag84dec
    New Member
    • Mar 2007
    • 100

    #1

    Protected member access problem

    Hi,
    I have a class in "testcommon .h"
    Code:
    class TestCommon
    {
       class TestOption
       {
       };
       typedef vector<TestOption*> TestOptionList;
       
       protected:
          TestOptionList             OptionList;
       };//TestOption is the inner class
    ...
    };
    and in a cpp file calles x.cpp
    i want to access OptionList....
    how???
    Last edited by AdrianH; Jul 13 '07, 04:50 PM. Reason: Indent please!
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    I'd recommend writing accessor methods into your class that will do the required manipulations.

    Comment

    • AdrianH
      Recognized Expert Top Contributor
      • Feb 2007
      • 1251

      #3
      Originally posted by sicarie
      I'd recommend writing accessor methods into your class that will do the required manipulations.
      Agreed, if you are protecting it, that means you have determined that it shouldn't be accessed directly.


      Adrian

      Comment

      Working...