Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


can inline function declare in private part of class?



can inline function declare in private part of class?..

Answer / meet

yes, inline functions can be declared in the private section of class. But why would you want it? small functions should be made inline and function defined inside the class are implicitly inline. if you keep inline function private it is must to provide public method (interface) that internally calls inline function.
Consider this:
#include <iostream>
using namespace std;
class PrivateInlinefunction {
int s;
void display();
public:
PrivateInlinefunction()
{
s=9;
}
void demo()
{
display();
}
};
inline void PrivateInlinefunction::show()
{
cout<<s<<endl;
}
int main()
{
Test* t=new Test;
t->demo();
delete t;
t=0;
return 0;
}

Private inline functions are almost never required. But you can make them as private or protected.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More OOPS Interview Questions

why the memory allocated with new cant be freed using free()

2 Answers  


What is class and object with example?

0 Answers  


Describe what an Interface is and how it?s different from a Class.

7 Answers   Spinsys,


Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer

0 Answers  


IN PROGRAMING LANGAUGE A C++ IS PURELY OBJECT ORIENTED OR NOT?

2 Answers  


ambiguity regulation of multiple inheritance with example.

1 Answers  


If a=5, b=6, c=7, b+=a%c*2. What is the final value of b?

1 Answers  


How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?

1 Answers   IntraLogic,


What do you mean by variable?

0 Answers  


What is the problem with multiple inheritance?

0 Answers  


wht is ditch

0 Answers  


why freind function takes more parameter than normal member function in c++?

1 Answers   IBM,


Categories