Write a new class named “VariableString” that must inherit from the "Variable" class. This class manages a variable name (string), description (string) and a value (string). Please note that this class must make use of inheritance. The class must at least provide the following methods: - toString() method that can return a string in the following format: VAR() DESC() VALUE() such as VAR(greeting) DESC(a welcome message) VALUE("Hello, World!") - override the "contains" method so that it not only searches through the name and description but also the value of the string
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++
Write a new class named “VariableString” that must inherit from the
"Variable" class. This class manages a variable name (string), description (string) and a
value (string). Please note that this class must make use of inheritance.
The class must at least provide the following methods:
- toString() method that can return a string in the following format:
VAR(<var-name>) DESC(<var-desc>) VALUE(<var-value>)
such as VAR(greeting) DESC(a welcome message) VALUE("Hello, World!")
- override the "contains" method so that it not only searches through the name and description but also the value of the string.
Step by step
Solved in 2 steps with 1 images