Construct the main program to allow the user to decide the number of each type of objects to be stored in the array.
Instantiate all the objects accordingly and demonstrate how each objects
behaves differently when the same instructions are given to them.
I'm not really get it what is allow user to decide the number of each type of object to be stored in array . what is this mean?
int RFID_array;
cout << "Enter number of RFID container : ";
cin >> RFID_array;
sc[RFID_array] = RFID_item;
int ManualShipping_array;
cout << "Enter number of Manual container : ";
cin >> ManualShipping_array;
sc[ManualShipping_array] = Manual_item;
Here is how to make an array of number objects of type someType. someType* pointerToTheArray = new someType[number];
You might see some people doing this: someType theArray[number];
This is incorrect C++, as C++ does not allow variable-sized arrays. Some compilers might let you do this. They really shouldn't.
constint TOTAL_CONTAINERS = 6;
ShippingContainer *sc[TOTAL_CONTAINERS];
int RFID_array;
cout << "Enter number of RFID container : ";
cin >> RFID_array;
RFIDShippingContainer *RFID_item = new RFIDShippingContainer[RFID_array];
int ManualShipping_array;
cout << "Enter number of Manual container : ";
cin >> ManualShipping_array;
ManualShippingContainer *Manual_item = new ManualShippingContainer[ManualShipping_array];
int main() {
//Declare an constant array of pointer to 6 Shipping Container Object
constint TOTAL_CONTAINERS = 6;
ShippingContainer *sc[TOTAL_CONTAINERS];
string theContent;
int RFID_array;
cout << "Enter number of RFID container : ";
cin >> RFID_array;
RFIDShippingContainer *RFID_item = new RFIDShippingContainer[RFID_array];
for( int i = 0 ; i < RFID_array ; i ++ ){
cout << "Enter Content of item : ";
getline( cin, theContent );
RFID_item[i].add( theContent );
}
int ManualShipping_array;
cout << "Enter number of Manual container : ";
cin >> ManualShipping_array;
ManualShippingContainer *Manual_item = new ManualShippingContainer[ManualShipping_array];
for( int i = 0 ; i < ManualShipping_array ; i ++ ){
cout << "Enter Content of item : ";
getline( cin, theContent );
Manual_item[i].setManifest( theContent );
}
so how i display all the getManifest for ShippingContainer ?
sc[0] = RFID_item;
sc[1] = Manual_item; << not really know how to declare since my array is been insert by user