Identify and correct the errors in the following class declaration: class nifty { // data char personality[];

Question:

Identify and correct the errors in the following class declaration:
class nifty
{
// data
char personality[];
int talents;
// methods
nifty();
nifty(char * s);
ostream & operator<<(ostream & os, nifty & n);
}
nifty:nifty()
{
personality = NULL;
talents = 0;
}
nifty:nifty(char * s)
{
personality = new char [strlen(s)];
personality = s;
talents = 0;
}

ostream & nifty:operator<<(ostream & os, nifty & n)
{
os << n;
}

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question

C++ Primer Plus

ISBN: 9780321776402

6th Edition

Authors: Stephen Prata

Question Posted: