I want to get inputs to a variable called “quantity”. The user can input it either in int or double types and the program needs to differentiate the type. Can I do it with C++?
For the moment, I have used an abstract base class in which the proper type can be Input when the type is given.
But what I want to do it keep both type under one particular variable in a Different class.
Ex.
How to store both int and double types in this “quantity” variable?Code:class Job { private: int day; Quantity quantity; Work* work; public: Job(){} ~Job(){} };