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 |
20% of a 6 litre solution and 60% of 4 litre solution are mixed what the % of mixture of solution it is resulted into?
What are the advantages of inheritance?
26 Answers IBS, TCS,
What is an orthogonal base class?
what is diff between .net 1.1 and .net 2.0
How to deploy web appliction in web logic ?
What is a class in oop?
What is polymorphism programming?
monkey starts climbing up a tree 20ft tall,each hour ,it hops 3ft and slips back by 2ft .how much time it wil tak to reach top of the tree?
class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
Describe the difference between a Thread and a Process?
What is differance between Abstract and Interface