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

inheritance - public, private, protected?

P: n/a
I was wondering, in C++ the syntax for inheritance is basically this:
class Descendant : public Parent {
....
};

Can someone tell me what would happen when I would replace 'public' by
'private' or 'protected'? I've looked through some tutorials on
inheritance, but the ones I found are mostly concerned with covering
the basic idea and simply skip over this and take it for granted, so
I'm hoping one of you can tell me.

Jun 28 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Jordi wrote:
I was wondering, in C++ the syntax for inheritance is basically this:
class Descendant : public Parent {
...
};

Can someone tell me what would happen when I would replace 'public' by
'private' or 'protected'? I've looked through some tutorials on
inheritance, but the ones I found are mostly concerned with covering
the basic idea and simply skip over this and take it for granted, so
I'm hoping one of you can tell me.


It's covered in the FAQ:

http://www.parashift.com/c++-faq-lit...heritance.html

Best regards,

Tom

Jun 28 '06 #2

P: n/a
Yes, thank you, I was just on my way to deleting this.

I'm new to these newsgroups, so I didn't know there was a FAQ... :$
Thomas Tutone schreef:
Jordi wrote:
I was wondering, in C++ the syntax for inheritance is basically this:
class Descendant : public Parent {
...
};

Can someone tell me what would happen when I would replace 'public' by
'private' or 'protected'? I've looked through some tutorials on
inheritance, but the ones I found are mostly concerned with covering
the basic idea and simply skip over this and take it for granted, so
I'm hoping one of you can tell me.


It's covered in the FAQ:

http://www.parashift.com/c++-faq-lit...heritance.html

Best regards,

Tom


Jun 28 '06 #3

P: n/a
Jordi wrote:
Yes, thank you, I was just on my way to deleting this.

I'm new to these newsgroups, so I didn't know there was a FAQ... :$
My notes (since you're new): (a) don't top-post and (b) always assume
that there is a FAQ list unless told otherwise (so, your first post
to any newsgroup should be "where do I find the FAQ?" unless you know
it already and have read it before posting), (c) do not treat any forum
as a "write-only" medium, always spend time *reading* it before even
thinking of posting.

Good luck!
[...]


V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 28 '06 #4

P: n/a
Thank you for your kind and patient comments. I kind of assumed that
the entire thread would disappear if I removed my message, because it
was the one that started this topic...

I have one last (probably totally stupid question):
How do I not top-post? Am I always supposed to reply to the last person
who posted in the thread, or always to the first?

Victor Bazarov wrote:
Jordi wrote:
Yes, thank you, I was just on my way to deleting this.

I'm new to these newsgroups, so I didn't know there was a FAQ... :$

My notes (since you're new): (a) don't top-post and (b) always assume
that there is a FAQ list unless told otherwise (so, your first post
to any newsgroup should be "where do I find the FAQ?" unless you know
it already and have read it before posting), (c) do not treat any forum
as a "write-only" medium, always spend time *reading* it before even
thinking of posting.

Good luck!
[...]

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 8 '06 #5

P: n/a
In article <11**********************@p79g2000cwp.googlegroups .com>,
jb*****@gmail.com says...

[ ... ]
How do I not top-post? Am I always supposed to reply to the last person
who posted in the thread, or always to the first?
Top-posting or otherwise isn't about which post you follow-up to.
It's about where you write your comments. When you write your
comments at the top of your post, followed by a quote of the post to
which you're following up, that's a top-post.

This post is at least an attempt at something closer to the
recommended style. When you post a follow-up, start by trimming away
all the quoted material that isn't directly relevant. Then write a
comment immediately following the quoted bit to which it applies. If
you want to comment on two or more parts, your comments get
interleaved with the quotes to which they reply.

If you can't find a relatively short bit to quote that really says
what you're commenting on, it's perfectly reasonable to write your
own summary of what you think they're saying. When you do this, you
do need to make it clear that this is your summary though -- usually
something like:

[... code demonstrating partial specialization elided ]

My comments on partial specialization go here...

As far as which post to follow up to: follow up to the post you want
to comment on, whether that's the first in the thread, the last, or
somewhere else. The topic of a thread can drift, and in some cases
sub-threads develop. Your comments might relate only distantly to
original post or the most recent one, so it wouldn't make any sense
to follow up to either of them.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jul 8 '06 #6

P: n/a

"Jordi" <jb*****@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Thank you for your kind and patient comments. I kind of assumed that
the entire thread would disappear if I removed my message, because it
was the one that started this topic...

I have one last (probably totally stupid question):
How do I not top-post? Am I always supposed to reply to the last person
who posted in the thread, or always to the first?
Like this.
Jul 8 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.