#ifndef media_h
#define media_h
class Media {
public:
Media (char* p = NULL,char* b = NULL, char = 'A', int = 1);
Media (const Media &);
Media & Operator= (const Media &);
~Media ( );
char* getBarCode ( ); // returns the bar-code of the media item
virtualvoid print ( ) const = 0;
private:
char* title; // pointer to a dynamically allocated array that store title
char* barCode;
char status; // āAā: available in stock, āSā: sold.
int type; // 1: Magazine, 2: Book, 3: Newspaper, 4:Film.
};
#endif
1 2 3 4 5 6 7 8 9
Media::Media(char* p, char* b , char s , int t)
{
title = newchar [strlen(p)+1];
strcpy(title,p);
barCode = newchar [strlen(b)+1];
strcpy(barCode,b);
status = s;
type = t;
}
why does this give an error??
can anyone explain......