Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10450
| From | Richard Damon <news.x.richarddamon@xoxy.net> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Cannot access protected from base class? |
| Date | 2011-09-24 23:56 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <j5m8ok$c8l$1@dont-email.me> (permalink) |
| References | <316d56c3-c003-48c5-a75f-6f9128194d92@i4g2000vbc.googlegroups.com> <j5lrp1$f9n$1@dont-email.me> <6c3103ee-946b-4458-a1df-0c1054658650@m15g2000vbk.googlegroups.com> |
On 9/24/11 8:24 PM, Nephi Immortal wrote: > On Sep 24, 7:14 pm, Richard Damon<news.x.richardda...@xoxy.net> > wrote: >> On 9/24/11 5:03 PM, Nephi Immortal wrote: >> >>> I discussed functionoids and pointer to member functions a long time >>> ago. The template is the best option over functionoids because of the >>> performance issue. Unfortunately, template does not support pointer >>> to member function array. >>> I am surprised to see that C++ Compiler reports an error to say any >>> member function cannot access to protected from base class, but >>> ordinary function worked. Very absurb? >> >> A derived class can only access the protected parts of a base camp >> through the derived class, not directly from the base camp. >> >> In your example, rather than using Obj1::run, use Obj::run. since Obj >> has inherited them, it can access them there. >> >> I will also add that this structure seems awkward. While having a large >> number of base classes is allowed, it feels like inheritance is being >> forced in a place where it really doesn't fit. > > I understand, but I wonder if large number of base classes violate > rule and needs to make sure if more memory is sufficient. A large number of base classes do not violate an inherent rule in C++. You will likely end up with a large object, as it needs to store all the base class members within it. It is possible that this may cause you to run out of memory, it somewhat depends on how many copies of this object are created. I do think it is a sign of a problematical design.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Cannot access protected from base class? Nephi Immortal <immortalnephi@gmail.com> - 2011-09-24 14:03 -0700
Re: Cannot access protected from base class? Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-24 20:14 -0400
Re: Cannot access protected from base class? Nephi Immortal <immortalnephi@gmail.com> - 2011-09-24 17:24 -0700
Re: Cannot access protected from base class? Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-24 23:56 -0400
Re: Cannot access protected from base class? Nephi Immortal <immortalnephi@gmail.com> - 2011-09-25 16:18 -0700
Re: Cannot access protected from base class? Ian Collins <ian-news@hotmail.com> - 2011-09-26 15:05 +1300
Re: Cannot access protected from base class? Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-25 22:38 -0400
Re: Cannot access protected from base class? Nephi Immortal <immortalnephi@gmail.com> - 2011-09-25 20:42 -0700
Re: Cannot access protected from base class? Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-26 00:20 -0400
csiph-web