Thread: Member function from class as a friend in another class

  1. #16
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by std10093 View Post
    I have in mind what grumpy said its 1st paragraph.
    Nowhere did I say that friend classes are bad (or not good) things. I said, in effect, that it is best to grant no more access to data within objects than needed. Friend declarations - be they of friend functions, friend classes, or friend member functions - provide a means for selectively grant access.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  2. #17
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    I suppose that we should design our code, like if it was to be handled by 100 programmers, even though it may be just for fun.
    OK...? But window and screen seem tightly coupled anyway. The only reason screen is different from window is because a window can hold several screens. But assuming we're looking for other options... I'm left wondering why there is no Screen::clear() method that window can call.

  3. #18
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by whiteflags View Post
    The only reason screen is different from window is because a window can hold several screens.
    Technically, a screen can render several windows too. Goes to show, if you are playing with concepts of windows and screens, you need to be clear about what each of them is and each of them isn't.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  4. #19
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    In my mind the more autonomous/private something is, the better. It's a matter of precaution. But I think we are about to go off topic..
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with namespace function declared as friend of class
    By Programmer_P in forum C++ Programming
    Replies: 7
    Last Post: 09-22-2012, 12:46 PM
  2. Replies: 4
    Last Post: 03-22-2012, 01:11 PM
  3. friend function template class declaration error
    By -EquinoX- in forum C++ Programming
    Replies: 2
    Last Post: 11-20-2009, 01:00 PM
  4. Replies: 8
    Last Post: 03-19-2008, 03:04 AM
  5. Replies: 5
    Last Post: 06-04-2002, 02:33 PM

Tags for this Thread