C++ (OOP) object oriented programming
function with parameter in a class.
#include<iostream.h>
#include<conio.h>
class student
{
public :
void add(int a,int b)
{
int c;
c=a+b;
cout << c <<endl;
}
};
main()
{
clrscr();
student s1;
int a,b,c;
cout <<"enter any number";
cin >> a;
cout <<"enter any number";
cin >> b;
s1.add(a,b); // calling of a function
getch();
}
Mar 20, 2007
Function with parameter in a class
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment