bartleby

Videos

Textbook Question
Book Icon
Chapter 15.1, Problem 3STE

Is the following a legal definition of the member function isCrazy in the derived class SmartBut discussed in Self-Test Exercise 2? Explain your answer. (Remember, the question asks if it is legal, not if it is a sensible definition.)

bool SmartBut::isCrazy( ) const

{

if (a > b)

return false;

else

return true;

}

Blurred answer
Students have asked these similar questions
Define a class called amount with properties "dollars" and "cents" oveload prefix and postfix ++ , -- as a member function and as a friend overload >> and << and assignment operator as friend function c++
Write down code that can declare a class of an employee with the properties, name and salary, and the methods, getSalary and getName, that return the salary and name of the employee respectively. Function members should be declared as prototypes only andinclude a parameterised constructor prototype to initialise with the name and salary.
In three sentences, explain why it's preferable to have accessors for private types rather than public types.

Chapter 15 Solutions

Problem Solving with C++, Student Value Edition plus MyProgrammingLab with Pearson eText -- Access Card Package (9th Edition)

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Call By Value & Call By Reference in C; Author: Neso Academy;https://www.youtube.com/watch?v=HEiPxjVR8CU;License: Standard YouTube License, CC-BY