Give a definition for a class SmartBut that is a derived class of the base classSmart given in the following. Do not bother with #include directives ornamespace details.class Smart{public:Smart( );void printAnswer( ) const;protected:int a;int b;};This class should have an additional data field, crazy, of type bool; oneadditional member function that takes no arguments and returns a value of type bool; and suitable constructors. The new function is named isCrazy. You do not need to give any implementations, just the class definition.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 7SA
icon
Related questions
Question

Give a definition for a class SmartBut that is a derived class of the base class
Smart given in the following. Do not bother with #include directives or
namespace details.
class Smart
{
public:
Smart( );
void printAnswer( ) const;
protected:
int a;
int b;
};
This class should have an additional data field, crazy, of type bool; one
additional member function that takes no arguments and returns a value of type bool; and suitable constructors. The new function is named isCrazy. You do not need to give any implementations, just the class definition.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Software Development
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning