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 is there no multiple inheritance?

0 Answers  


Is enum a class?

0 Answers  


what about you? wahat is your object? introduce your self?

1 Answers   Ajmal Perfumes, TCS,


Is this job good for future? can do this job post grduate student?

0 Answers  


Finding of the 4 larger (bigger) numbers from the list like{1245,4587,2145,1163,29987,65783.....}

1 Answers   Wipro,


What Is a Polymorphism? How many types of polymorphism and whats that use in application?

2 Answers  


Is following functions are said to be overloaded? int add(int a,int b) char *add(int a,int b)

4 Answers  


WAP to generate 2n+1 lines of the following pattern on the computer screen:

2 Answers  


Can abstract class have normal methods?

0 Answers  


What is the expansion of OOPS?

24 Answers   TCS,


What is this interview room ? Is it a class or an object.

3 Answers   CybAge, NSN, Wipro,


You have one base class virtual function how will call that function from derived class?

4 Answers  


Categories