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 |
how to swap the variables without using temp and operators
what are the realtime excercises in C++?
what is overloading
Can bst contain duplicates?
what is graphics
Why is encapsulation used?
What do you mean by overloading?
Can we override main method?
Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box
In which Scenario you will go for Interface or Abstract Class?
1 Answers InfoAxon Technologies,
What is function overloading and operator overloading?
what's the basic's in dot net