Re: What are friend classes?

Discussion in 'C++' started by Snyke, Aug 5, 2004.

  1. Snyke

    Snyke Guest

    And what's the difference between inheritance and friend relationship?
    Snyke, Aug 5, 2004
    #1
    1. Advertising

  2. Snyke wrote:
    > And what's the difference between inheritance and friend relationship?
    >


    Totally orthogonal concepts. How can you define a difference between,
    say, a house and studying at school? What's the difference between
    a loaf of bread and riding a motorcycle?

    Inheritance is a process (and the result) of deriving another type from
    a given one. Friendship is a state in which one entity is granted some
    exclusive access to the given entity's areas otherwise inaccessible to
    it.

    I am not a master of definitions, of course, read your favourite OOD book
    to get a better worded explanation.

    V
    Victor Bazarov, Aug 5, 2004
    #2
    1. Advertising

  3. Snyke

    Mike Wahler Guest

    "Snyke" <> wrote in message
    news:ceto88$...
    > And what's the difference between inheritance and friend relationship?


    Inheritance allows a new type to share the
    characterstics and behavior of an existing type,
    and for which such charactersistics and behavior
    may be overridden for the new type.

    Friendship simply grants access to private members
    of a class from outside the scope of that class.
    Friendship can be granted to either a nonmember function
    or to another class. Nothing to do with inheritance.

    -Mike
    Mike Wahler, Aug 5, 2004
    #3
  4. Snyke

    jeffc Guest

    "Snyke" <> wrote in message
    news:ceto88$...
    > And what's the difference between inheritance and friend relationship?


    These broad concepts are better answered by reading a book or searching the
    internet.
    jeffc, Aug 5, 2004
    #4
  5. Snyke

    red floyd Guest

    Snyke wrote:
    > And what's the difference between inheritance and friend relationship?
    >


    Remember, only you and your friends can play with your private parts.
    Your children can't play with them, but they can play with your
    protected parts.
    red floyd, Aug 6, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. z f
    Replies:
    0
    Views:
    298
  2. Alexander Stippler

    nested classes and friend declaration

    Alexander Stippler, Jul 2, 2003, in forum: C++
    Replies:
    1
    Views:
    383
    Victor Bazarov
    Jul 2, 2003
  3. Adam Parkin
    Replies:
    6
    Views:
    516
    Victor Bazarov
    Apr 24, 2004
  4. Srini nandiraju

    friend classes

    Srini nandiraju, May 19, 2004, in forum: C++
    Replies:
    5
    Views:
    2,583
    David White
    May 19, 2004
  5. Peter
    Replies:
    2
    Views:
    272
    Öö Tiib
    Jun 6, 2013
Loading...

Share This Page