By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

Some puzzles about sgistl!

P: n/a
Hi,

I have some puzzles about sgistl source code, that is why some methods
are placed in protected field.

To vector itself, private and protected are the same, and vector isn't
desired to be the base class of other containers.

So why not use private instead of protected?

Anyone can explain it for me?

Thanks in advance!
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Kevin Wan" <jf***@vip.sina.com> wrote...
I have some puzzles about sgistl source code, that is why some methods
are placed in protected field.

To vector itself, private and protected are the same, and vector isn't
desired to be the base class of other containers.
Why isn't it?
So why not use private instead of protected?
If you can answer why I couldn't inherit from vector, then I will
probably agree that private is better.
Anyone can explain it for me?


As soon as you can explain why you think vector shouldn't be a base
class. Please do not give the old "no virtual destructor" spiel
because I am not going to delete my derived class polymorphically.

Victor
Jul 19 '05 #2

P: n/a
Victor Bazarov wrote:
....
As soon as you can explain why you think vector shouldn't be a base
class. Please do not give the old "no virtual destructor" spiel
because I am not going to delete my derived class polymorphically.


I don't mean to open old wounds and add lemon juice but I need to know
if the concensus is that this is now a DEAD topic. I really don't want
to start another flameola. I hope I can now create derivable classes
with impunity without virtual destructors and not have the virtual
destructor police knocking down my door.
Jul 19 '05 #3

P: n/a
"Victor Bazarov" <v.********@attAbi.com> wrote in message news:<pVs%a.157066$o%2.66713@sccrnsc02>...
"Kevin Wan" <jf***@vip.sina.com> wrote...
I have some puzzles about sgistl source code, that is why some methods
are placed in protected field.

To vector itself, private and protected are the same, and vector isn't
desired to be the base class of other containers.
Why isn't it?

I remember Scott Meyers told that never publicly inherit from a class
which has no virtual destructor. You can make sure you'll not use it
polymorphically, but you can't force your client not to use it
polymorphically!

And if you use private or protected inheritance, the useful public
methods need to be re-written, as you know, the inherited methods
aren't public! I think it's a boring task!
So why not use private instead of protected?


If you can answer why I couldn't inherit from vector, then I will
probably agree that private is better.
Anyone can explain it for me?


As soon as you can explain why you think vector shouldn't be a base
class. Please do not give the old "no virtual destructor" spiel
because I am not going to delete my derived class polymorphically.


Would you please show me your ideas about what I metioned above?

Thank you very much!

Kevin
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.