Computer Science, asked by bandhubajaj4706, 1 year ago

Unsolved answers for constructor and destructor

Answers

Answered by deydeb967
0

#include <iostream.h>

#include<string.h>

class bazaar

{ char Type[20] ;

char product [20];

int qty ;

float price ;

bazaar()

//function 1

{ strcpy (type , “Electronic”) ;

strcpy (product , “calculator”);

qty=10;

price=225;

}

public :

void Disp() //function 2

{ cout<< type <<”-”<<product<<”:” <<qty<< “@” << price << endl ;

}

};

void main ()

{ Bazaar B ; //statement 1

B. disp() ; //statement 2

}

Similar questions