Thursday, March 17, 2011

Cpp program4

/*
Intrduce class specifier and their constructor and destructor
*/

# include "iostream"
using namespace std;
# include "stdio.h"

class Check
{
public:
void print()
{
printf("A program with a difference\n");
}
Check()
{
printf("Starting up \n");
}

~Check()
{
printf("close program\n");

}
};

int main()
{

Check First;
First.print();

return 0;


}


OUTPUT:
Starting up
A program with a difference
close program
Press any key to continue . . .

No comments:

Post a Comment