Put Back Functions

L

Last Timer

I have these interview questions and could use some help in polishing
my knowledge:

a) what are put back functions?
b) is containment better than private inheritence?
(please contrast it with composition)
c) can we have flat out separate classes with friend functions?
Thanks for your help
 
S

Shezan Baig

Last said:
I have these interview questions and could use some help in polishing
my knowledge:

a) what are put back functions?

Search the net for "streambuf"
b) is containment better than private inheritence?
(please contrast it with composition)

This is discussed all over the net. Try "www.google.com"
c) can we have flat out separate classes with friend functions?
I have no idea what this means.

Hope this helps,
-shez-
 
M

Mike Wahler

Last Timer said:
I have these interview questions and could use some help in polishing
my knowledge:

a) what are put back functions?

Functions which cause previously extracted data from
a stream to be resubmitted to a subsequent extraction.
Note that 'put-back' functions are restricted in
what they can do. See a good C++ text for details.
b) is containment better than private inheritence?

Better for what? Without context, this question cannot
have a 'correct' or 'incorrect' answer.
(please contrast it with composition)

Inheritance expresses an 'is a' relationship between
types. Composition expreses a 'has a' relationship
between types.
c) can we have flat out separate classes with friend functions?

Yes. But whether doing so is a good idea depends upon
context.

I suggest that you do your 'polishing' by reading some
good C++ texts, rather than simply asking ad hoc questions
here. See www.accu.org for peer reviews.

Have you read the C++ FAQ?
http://www.parashift.com/c++-faq-lite/

-Mike
 
D

Dave Moore

Mike Wahler said:
Functions which cause previously extracted data from
a stream to be resubmitted to a subsequent extraction.
Note that 'put-back' functions are restricted in
what they can do. See a good C++ text for details.


Better for what? Without context, this question cannot
have a 'correct' or 'incorrect' answer.


Inheritance expresses an 'is a' relationship between
types.

This is true only for public inheritance .. the OP's question was about
private inheritance, which expresses an "is implemented in terms of"
relationship between types.
Composition expreses a 'has a' relationship
between types.

Usually, but it can also express "is implemented in terms of", for example
in the case of the useful pimpl idiom.

What does "flat out separate classes" mean?
Yes. But whether doing so is a good idea depends upon
context.
[snip]

Dave Moore
 
H

Howard

Dave Moore said:
What does "flat out separate classes" mean?

In my experience, "flat out" is often used to mean "completely" or
"totally". I'd assume that he means there is no inheritance between the
classes, nor any containment of one by the other (or of pointers or
references to each other).

Of course, assumptions are not always accurate... in fact they're sometimes
flat out wrong! :)

-Howard
 
S

Shezan Baig

Howard said:
In my experience, "flat out" is often used to mean "completely" or
"totally". I'd assume that he means there is no inheritance between the
classes, nor any containment of one by the other (or of pointers or
references to each other).

Of course, assumptions are not always accurate... in fact they're sometimes
flat out wrong! :)

-Howard

Hmmm... but why would we need to qualify it with "flat out"... wouldn't
just "separate classes" be sufficient without changing the meaning?...
;)

-shez-
 

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,201
Messages
2,571,048
Members
47,647
Latest member
NelleMacy9

Latest Threads

Top