OOPC Practical 12


Practical : 12
Subject : Object Oriented Programming with C++

Aim : C++ program to demonstrate concept of constructor


Source Code :
#include<iostream.h>
#include<conio.h>
class s
{
public:
s()
{
}
s(intx,int y)
{
int z;
z=x+y;
cout<<"x : "<<x<<endl<<"y : "<<y<<endl;
cout<<"x + y = "<<z;
}
};
void main()
{
clrscr();
s(10,12);
getch();
}

Output :


Pratik Boghani

Author & Editor

Life is all about the next step.

0 comments:

Post a Comment