Question 3 Identify and correct errors in the following class declaration: class nifty { // data char personality[]; int talents: // methods nifty(); nifty(char* s);
Question 3 Identify and correct errors in the following class declaration: class nifty { // data char personality[]; int talents: // methods nifty(); nifty(char* s);
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 3PE
Related questions
Question
100%
![W
FILE
Be
Paste
2
=
HOME INSERT
Times New Ro 12
BI Uabe X₂ X²
Font
Clipboard
DESIGN PAGE LAYOUT
Α Α΄ Aa
EE 。 AaBbCcDc AaBbCcDc AaBbC, AaBbCCE
Normal I No Spac... Heading 1 Heading 2
A-ay-
Paragraph
Г
Styles
G
TUTTCLOITS pemave.
Question 3
Identify and correct 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;
}
PAGE 1 OF 2 47 WORDS DX ENGLISH (UNITED STATES)
Document1 Word
REFERENCES MAILINGS REVIEW VIEW
E R
?
Find
ac Replace
Select
Editing
2
Sign in
X
90%](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ffa49174d-125a-4d69-a621-28c8c9dfa0bc%2Fcd8bd93c-f2e2-4112-ace2-a995f2ed7787%2Ff2c05si_processed.jpeg&w=3840&q=75)
Transcribed Image Text:W
FILE
Be
Paste
2
=
HOME INSERT
Times New Ro 12
BI Uabe X₂ X²
Font
Clipboard
DESIGN PAGE LAYOUT
Α Α΄ Aa
EE 。 AaBbCcDc AaBbCcDc AaBbC, AaBbCCE
Normal I No Spac... Heading 1 Heading 2
A-ay-
Paragraph
Г
Styles
G
TUTTCLOITS pemave.
Question 3
Identify and correct 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;
}
PAGE 1 OF 2 47 WORDS DX ENGLISH (UNITED STATES)
Document1 Word
REFERENCES MAILINGS REVIEW VIEW
E R
?
Find
ac Replace
Select
Editing
2
Sign in
X
90%
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,