Hye....i have a problem with my c++ program. i have an error when to compile it....please help me...i didnt know how to solve it....I got this error when i compile it...
* '=' cannot convert from 'char' to 'char[50]....it show in setData function...Please help me...
Code:
#include <iostream.h>
class Book
{
public:
struct BookData
{
char Author[50];
char ISBN[50];
char Publisher[50];
int Year;
}s_BookData;
public:
Book();
Book(char c_Author, char c_ISBN, char c_Publisher, int c_Year);
~Book();
void setData(char c_Author, char c_ISBN, char c_Publisher, int c_Year);
void getData();
};
Book::~Book()
{
cout<<"The object has been deleted";
};
Book::Book(char c_Author, char c_ISBN, char c_Publisher, int c_Year)
{
setData(c_Author, c_ISBN, c_Publisher, c_Year);
};
void Book::setData(char c_Author, char c_ISBN, char c_Publisher, int c_Year)
{
s_BookData.Author = c_Author;
s_BookData.ISBN = c_ISBN;
s_BookData.Publisher = c_Publisher;
s_BookData.Year = c_Year;
};
void Book::getData()
{
cout<<s_BookData.Author;
cout<<s_BookData.ISBN;
cout<<s_BookData.Publisher;
cout<<s_BookData.Year;
};
void main()
{
Book obj1("ME", "NOT ME", "NOT ME AGAIN", 16);
obj1.getData();
};