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.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
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.

Step by step
Solved in 3 steps with 1 images









