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 |
what is a ststic variable and stiticfunction briefly explain with exmple and in which case we use
what is the difference between class and structure in C++?
can inline function declare in private part of class?
write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.
What is protected in oop?
i got a backdoor offer in process global,Bangalore..Can i work with it?
Finding of the 4 larger (bigger) numbers from the list like{1245,4587,2145,1163,29987,65783.....}
what are the ways in which a constructors can be called?
tell about copy constructor
Plese get me a perfect C++ program for railway/airway reservation with all details.
what are the uses of C++
What are the important components of cohesion?