Menu

Wednesday, 26 November 2014

Chapter 6,Problem 8:Object Oriented Programming by Robert Lafore in C++ Solution Manual

//Engr. Ahamad Furqan Attari
//Chapter 6, Problem 8
#include <iostream>
#include <conio.h>
using namespace std;
class Furqan
{
private:
 int serial;
 static int count;
public:
 Furqan()
 { 
  count++;
  serial=count;
 }
 void report_serial(void)
 {
  cout<<"I'm object number "<<serial<<endl;
 }
};
int Furqan::count=1;
void main(void)
{
 Furqan f1,f2,f3;
 f1.report_serial();
 f2.report_serial();
 f3.report_serial();
 getch();
}

No comments:

Post a Comment