Friday 8 April 2016

WAP for copy constructor

#include<iostream.h>
#include<conio.h>
class Game{
  int goals;
  public:
Game(){
  goals=0;
}
int getgoals(){
return goals;
}

int incrementgoals()
{
 return goals++;
}
};


void main(){
  Game g;
  clrscr();
  cout<<"
No od goal when game is stared..       : "<<g.getgoals();
  g.incrementgoals();
  g.incrementgoals();
  cout<<"
No od goal when game is little later.. : "<<g.getgoals();
  getch();
  }

No comments:

Post a Comment