Solved

functions in a struct ?

Posted on 2003-10-27
1
215 Views
Last Modified: 2010-04-02
Hi C++ Expert,

   Is that the same to define a function inside and outside a struct definition ? i.e.
------------------------
 struct A{
   int f1(){ return 0;}
   int f2() ;
 };
 int A::f2(){return 0;}
------------------------
what's the difference between f1() and f2() ?? Thanks ........
0
Comment
Question by:meow00
1 Comment
 
LVL 1

Accepted Solution

by:
fsign21 earned 50 total points
ID: 9627982
fi is defined as inline function, f2 not.
Have a look on
http://users.utu.fi/~sisasa/oasis/cppfaq/inline-functions.html#[9.6]
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C++ get user from AD  (VS6) 7 82
Would like to move button in a function 3 79
Grammars for C C++ and java 1 131
Better understanding on C++ Class serialization and formats 9 78
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question