Function in C++ by R4R Team

What is Function or Data Method?
In C language we have a function, so data method are nothing new they are also function but in many programming language like C++, java etc function are called as data method.
-function inside class called as data method

How make function or data method inside class?


#include < iostream>
using namespace std;
//Create class
class myclass
//Create data method(function)
int func()
cout<<"This is my function";
int main()
//create object
myclass obj;
//call data method
return 0;


This is my function

-In this program, we create a class and then create a simple function named as 'func()' which print one statement.

Leave a Comment:
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on 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!