Thread: inline friend functions.

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912

    inline friend functions.

    I posted a question about this project (but a different topic altogether) a few days ago about overloading the * (dereferencing) operator. The question was answered, worked, but it brought up another question. I have function a. It is declared as a friend to class b. Function a needs to be an inline function. Would I write the function definition as:

    - friend inline void function_a(int parameter);

    If not, what do i need to rearrange?

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    You declare friend functions within class declarations. You don't specify inline functions within class declarations, they're automatically inline if you provide a body. If you're providing a seperate definition you don't have to specify the function is a friend because you will already have in the declaration.
    zen

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Thanks. What's annoying though is that almost everytime I post a question, by the time i get a reply, I've figured it out myself... stupid Murphys Law..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inline functions
    By Sharke in forum C++ Programming
    Replies: 6
    Last Post: 05-13-2009, 06:18 AM
  2. inline empty polymorphic functions
    By CodeMonkey in forum C++ Programming
    Replies: 8
    Last Post: 01-16-2009, 12:12 PM
  3. Friend functions
    By warfang in forum C++ Programming
    Replies: 12
    Last Post: 04-22-2007, 02:14 PM
  4. Friend functions
    By JeremyCAFE in forum C++ Programming
    Replies: 2
    Last Post: 02-12-2006, 08:08 PM
  5. inline functions
    By robid1 in forum C++ Programming
    Replies: 1
    Last Post: 06-13-2004, 05:00 AM