inline friend functions.

This is a discussion on inline friend functions. within the C++ Programming forums, part of the General Programming Boards category; I posted a question about this project (but a different topic altogether) a few days ago about overloading the * ...

  1. #1
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

    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
    zen
    zen is offline
    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
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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, 07: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, 03: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, 06:00 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21