Here I am going to Introduce you with the Objects in c++
Here is the link of tutorial video
The code is giver below....
#include<iostream>
using namespace std;
class myclass
{
int i;
public:
myclass(int a) {i=a;}
int get_i() {return i;}
int sqr_it() {return i*i;}
};
int sqr_i(myclass o)
{
return o.get_i()*o.get_i();
}
int main()
{
myclass a(10);
cout<<sqr_i(a)<<endl;
cout<<a.sqr_it();
}
Friday, October 9, 2015
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment