Constructors


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#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
	virtual void 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 = new char [strlen(p)+1];
	strcpy(title,p);
	barCode = new char [strlen(b)+1];
	strcpy(barCode,b);
	status = s;
	type = t;
}


why does this give an error??
can anyone explain......
its okaii..........i figured out my mistake =D
Topic archived. No new replies allowed.