list of 7, 8 concepts for learning c++

K

K4 Monk

1. Polymorphism: function level and through derived class. Also
through templates
2. Streams: everything I/O involves streaming
3. Implementation level representation of an object.
4. Implementation level representation of member objects
5. Three types of inheritance and why should they be used: private,
protected, and public
6. Implementation level representation of derived class objects
7. Multiple inheritence, and where it is necessary
8. The clusterfuck made up of the above 7
 
B

Bo Persson

K4 said:
1. Polymorphism: function level and through derived class. Also
through templates
2. Streams: everything I/O involves streaming
3. Implementation level representation of an object.
4. Implementation level representation of member objects
5. Three types of inheritance and why should they be used: private,
protected, and public

An here's the exam question:

When do you use protected inheritance?
 
Ö

Öö Tiib

An here's the exam question:

When do you use protected inheritance?

Anyway fail since there are 6 types of inheritance in C++: private,
private virtual, protected, protected virtual, public and public
virtual.
 
K

K4 Monk

Anyway fail since there are 6 types of inheritance in C++: private,
private virtual, protected, protected virtual, public and public
virtual.

You're correct. What else do you think makes up C++?
 
J

Juha Nieminen

K4 Monk said:
1. Polymorphism: function level and through derived class. Also
through templates
2. Streams: everything I/O involves streaming
3. Implementation level representation of an object.
4. Implementation level representation of member objects
5. Three types of inheritance and why should they be used: private,
protected, and public
6. Implementation level representation of derived class objects
7. Multiple inheritence, and where it is necessary
8. The clusterfuck made up of the above 7

And what is the alternative you suggest? Not having polymorphism? Not
having templates? Not having type-safe streams?

As for implementation-level representation of classes, it's necessary
for efficiency and to determine access rights. (There exist technologies
to achieve the same thing with more abstract code, but usually they put
quite heavy demands on the runtime environment, usually requiring things
like JIT compilation.)

As for multiple inheritance, all OO languages I know of have multiple
inheritance. It's just that in most other languages it's a crippled
version that is significantly less useful than in C++. (They don't *call*
it "multiple inheritance", and they vehemently deny that it is, but that's
what it is, plain and simple. Just because it's a crippled version doesn't
mean it's not multiple inheritance.)
 
P

ptyxs

After giving some explanations about public and private inheritance,
Scott Meyers, in his book Effective C++, Third Edition, Item 32, adds
this remark :

"...and protected inheritance is something whose meaning eludes me to
this day."

I conclude that, at least, it is not a notion very much useful for
beginners.
 
C

cpp4ever

1. Polymorphism: function level and through derived class. Also
through templates
2. Streams: everything I/O involves streaming
3. Implementation level representation of an object.
4. Implementation level representation of member objects
5. Three types of inheritance and why should they be used: private,
protected, and public
6. Implementation level representation of derived class objects
7. Multiple inheritence, and where it is necessary
8. The clusterfuck made up of the above 7

As ever, the important understanding of scope rules is not mentioned. As
object orientation is about need to know, and hence black box
encapsulation. I'd have thought scope rules would get more than the
minimum coverage it mostly does. But I appear to be in the minority on
this topic, so my importance level attached to scope rules may be over done.

Regards

cpp4ever
 
N

Nick Keighley

1. Polymorphism: function level and through derived class. Also
through templates
2. Streams: everything I/O involves streaming
3. Implementation level representation of an object.

why do you need to know this? I don't think about the implementaion
representaion of an object when I'm programming in C++. I don't
actually know what the representaion is on most of my platforms!
4. Implementation level representation of member objects

as 3
5. Three types of inheritance and why should they be used: private,
protected, and public

ok. These days the answer for "protected" would be "almost never"
6. Implementation level representation of derived class objects

as 3 and 4
7. Multiple inheritence, and where it is necessary

and its pifalls. The Dreaded Diamond.
8. The clusterfuck made up of the above 7

perhaps you'd have less of a CF if you stopped thinking abount
representaion and implementaion.

You missed exception safety, const correctness, RAII and probably a
lot of other stuff.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,143
Messages
2,570,821
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top