So, I'm reading Schildt's book 3rd edition about C++ and I'm doing all examples, but I have some PHP background and when I tried some stuff it occurs that it can not be compiled this way.I saw the Schildt's solution, so I'll give what I've tried to do and how it's done in the book, what I need to know, is there any way to make it work adjusting my function?
Here's what I'm trying
class card {
char author[40];
//char book[30];
int count;
public:
void store(char *auth,int ct);
void show();
};
void card::store(char *auth,int ct){
&author = *auth;
count = ct;
}
int main(){
card ob1, ob2;
ob1.store('Tolkin',10);
ob2.store('Pratchet',3);
ob1.show();
ob2.show();
return 0;
}
And here's the Schildt's solution:
class card {
char author[40];
int count;
public:
void store(char *auth,int ct);
void show();
};
void card::store(char *auth,int ct){
strcpy(author, auth);
count = ct;
}