eTech 69

The Home of Technology

Select your Language

| | | | | | | Blogger Tips And Tricks|Latest Tips For BloggersFree BacklinksBlogger Tips And Tricks | | | | | | | | | | | | | | | | | | | | | | | | | |

Friday, October 9, 2015

Returning Objects from Function

1 comment :
 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;
}

Passing Function to Objects

No comments :
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();
}

Programming In C++

No comments :
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