Pages

Thursday, November 26, 2015

parameterized constructor

#include<iostream>
#include<conio.h>
class k
                        {
      int a,b;
    public:
    k(int x,int y)
    {

    a=x;
    b=y;
    }
    void Dis()
    {
    cout<<"Values :"<<a<<"\t"<<b;
    }
};

int main()
          {
        k d(10,20);
        d.Dis();
        getch();
}

No comments:

Post a Comment