in c++ Define another new class named “Item” that must inherit from the given Name class. This Item class will manage the following info: name (string) and price (double). It must prevent the creation of an Item object with either an empty or all-blank name. This class must at least complete the methods defined in the Name class: toString method returns a string representation of the Item object in the format of “ITEM( ) PRICE($ ) such as ITEM(eraser) PRICE($1.05) contains method that accepts a search string and returns true if only the name of the item contains the search string as a substring. It returns false otherwise. isTheSame method that compares two Item objects and returns true only if both Item objects have the exact same name (regardless of the price) and false otherwise. Please note that if the given object in the parameter is not an Item object, it will return false.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter1: A First Program Using C#
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question

in c++

Define another new class named “Item” that must inherit from the given Name
class. This Item class will manage the following info: name (string) and price
(double). It must prevent the creation of an Item object with either an empty or
all-blank name.

This class must at least complete the methods defined in the Name class:

toString method returns a string representation of the Item object in the format of
“ITEM( <name> ) PRICE($ <price> )
such as
ITEM(eraser) PRICE($1.05)

contains method that accepts a search string and returns true if only the name of
the item contains the search string as a substring. It returns false otherwise.

isTheSame method that compares two Item objects and returns true only if both
Item objects have the exact same name (regardless of the price) and false
otherwise. Please note that if the given object in the parameter is not an Item
object, it will return false. 

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Class
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,