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

what is the new version of oops

0 Answers   Ignou,


what is polymorphism?

4 Answers  


What is OOPS and How it is different from Procedural Programming ?

23 Answers   HP, Infosys, Thyrocare,


What do we mean by a hidden argument in a function?

1 Answers   TCL,


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

2 Answers  


which is best institute to learn c,c++ in ameerpet hyderabad

1 Answers  


diff between Abstract class Interfaces?

4 Answers  


Which is the only operator in C++ which can be overloaded but NOT inherited?

8 Answers  


define oops with class and object

5 Answers   HCL, Tech Mahindra,


What is abstraction in oops with example?

0 Answers  


Get me a number puzzle game-program

0 Answers  


How is polymorphism achieved?

0 Answers  


Categories