Tuesday, 24 February 2015

Static Function Using C++

#include<iostream.h>
#include<conio.h>
class StatDemo
{
public:
static int Square(int a)
{
return a*a;
}
static int Cube(int a)
{
return a*a*a;
}
};
main()
{
clrscr();
cout<<"\n Square of 10 is :"<<StatDemo::Square(10);
cout<<"\n Cube of   10 is :"<<StatDemo::Cube(10);
getch();
}

No comments:

Post a Comment