#include #include using namespace std; class ItemT { public: ItemT(){ cout << " In the default constructor for an ItemT" << endl; } void Talk(void) const{ cout << "Hello" << endl; } private: int data1{8}; }; class ThingT { public: ThingT() = delete; ThingT(int i) { cout << "Integer constructor for a ThingT i = " << i << endl; } ThingT(int i, char j) { cout << "Integer, char constructor for thingT i = " << i << " j = " << j << endl; } }; int main() { // bad the compiler thinks the next line is a function prototype for myItem /* ItemT myItem(); myItem.Talk(); /**/ // good declarations, there is a default constructor. cout << "Declaring a vector of 3 ItemTs" << endl; vector items(3); cout << endl; cout << "Declaring an array of 4 ItemTs" << endl; ItemT moreItems[4]; cout << endl; // this will not work, no default constructor. //ThingT data[2]; // this will cout << "A vector of things with the int constructor" << endl; vector things{3,4,5}; cout << endl; cout << "Two different ways to call a constructor " << endl; ThingT data1{1,'c'}; ThingT data2(2,'d'); cout << endl; return 0; }