GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 87 of 203    Print  
What is the difference between Function and Member function?

  
Total Answers and Comments: 3 Last Update: June 13, 2007     Asked by: sharath 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 15, 2006 00:42:41   #1  
Amar        

RE: What is the difference between Function and Member...
A function declared/defined within a class is a member function and a function declared/defined outside the scope of a class is a function.
 
Is this answer useful? Yes | No
November 22, 2006 08:29:13   #2  
Sachin Bidwai        

RE: What is the difference between Function and Member...

I am going to answer this by considering Function as a Normal Function (non member function)

We can access the member function by an object of that class.

Function has not required an object of that class.

we can apply the visiblity levels to the member function.

we cant apply the visiblity levels to the function.


 
Is this answer useful? Yes | No
June 13, 2007 16:00:33   #3  
SomGollakota Member Since: June 2007   Contribution: 48    

RE: What is the difference between Function and Member...
Assuming function is not a part of any class and member function (obviously) is a part of a class the difference is their scope.

1. Function - is normally refered to a C-style function which has a global level scope. As long as its declaration is visible in a file where it is being used and the definition is available somewhere in the application the linker will find the definition and link to it. It can be used anywhere in the application.

2. Member function - is normally referred to a C++Style method declared/defined inside of a C++ class. The scope for such member functions is the class. They are not accessible outside the class and are only accessible thru an object/instance of such a class. There are of course exceptions to this such as static and friends.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape