click here for video Tutorial
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;
class myclass
{
char s[80];
public:
void set(char *str) { strcpy(s,str);}
void show() {cout<<s<<endl;}
};
myclass input()
{
char s[80];
cin>>s;
myclass ob;
ob.set(s);
return ob;
}
int main()
{
myclass o;
o=input();
o.show();
return 0;
}
Friday, October 9, 2015
Passing Function to Objects
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();
}
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();
}
Programming In C++
Here we are Going to Show you the Special features of C++. The topics are given below. And i Will try to add video with instraction where it is much required..
Passing objects in a function
Passing objects in a function
Subscribe to:
Posts
(
Atom
)