My class of a item of furniture, and sofa with item inherited is below:
The constructor which i have marked "This constructor" is the one I am working on. I want a constructor with no parameters which allows the user to enter data members interactively. How is this done?Code:#include <iostream> #include <fstream> using namespace std; class Item { public: string modelName; int numberInstock; Item(){} Item(int name){} virtual void UpdateNumber(){} virtual void printDetails() { } }; class Sofa:public Item { public: Sofa (string a , string b) : Item () { fabric = a; colour = b; } Sofa () : Item () { cout << "Enter type of fabric: "; //// This constructor cin >> fabric; cout << endl << "Enter colour of fabric: "; cin >> colour; cout << endl; } string fabric; string colour; void printDetails(){} };
Thanks




Reply With Quote