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 |
Why is there no multiple inheritance?
Is enum a class?
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?
Finding of the 4 larger (bigger) numbers from the list like{1245,4587,2145,1163,29987,65783.....}
What Is a Polymorphism? How many types of polymorphism and whats that use in application?
Is following functions are said to be overloaded? int add(int a,int b) char *add(int a,int b)
WAP to generate 2n+1 lines of the following pattern on the computer screen:
Can abstract class have normal methods?
What is the expansion of OOPS?
What is this interview room ? Is it a class or an object.
You have one base class virtual function how will call that function from derived class?