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

how to swap the variables without using temp and operators

1 Answers  


what are the realtime excercises in C++?

0 Answers   IBM, Wipro,


what is overloading

3 Answers   MindCracker,


Can bst contain duplicates?

0 Answers  


what is graphics

0 Answers  


Why is encapsulation used?

0 Answers  


What do you mean by overloading?

0 Answers  


Can we override main method?

0 Answers  


Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box

0 Answers  


In which Scenario you will go for Interface or Abstract Class?

1 Answers   InfoAxon Technologies,


What is function overloading and operator overloading?

4 Answers  


what's the basic's in dot net

0 Answers   informatics,


Categories