How we define the function outside the class ?

How we define the function outside the class ?

How define function outside class in C++:
-We define a function outside the class using scope resolution operator(::)

program:

#include < iostream>

using namespace std;
class Myclass
{
public:
void function();
};
void Myclass::function()
{
cout<<"This is my function outside class";
}
int main()
{
Myclass obj;
obj.function();
return 0;
}


output-

This is my function outside class




Read More →
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!