/* C++ program For the IMPLEMENTATION OF STATIC DATA MEMBERS */
#include< iostream.h>
#include< conio.h>
class book
{
private:
static int count;
int bookid;
public:
addbook(void)
{
count ++;
bookid=count;
}
displaybook()
{
cout< < "The Number Of The Books Are:"< < count;
}
};
int book::count;
void main()
{
book b1,b2;
clrscr();
b1.addbook();
b2.addbook();
b1.displaybook();
cout< < endl;
b2.displaybook();
getch();
}
/* OUTPUT
The Number Of The Books Are:2
The Number Of The Books Are:2
*/
Monday, February 4, 2008
Subscribe to:
Post Comments (Atom)
3 comments:
Ok thanks its working
can i get the algorithm for the program
algorithm please
Post a Comment