educative.io

Regarding orderId in Package Class

Since, a object of Package contains an item, why we are not storing reference of order in Package Class instead of orderid in the current code.
//current code
class Package {
private:
string packageId;
double packageSize;
string orderId;

public:
void pack();
};
//why it is not like this?
class Package {
private:
string packageId;
double packageSize;
Order order;

public:
void pack();
};


Course: Grokking the Low Level Design Interview Using OOD Principles - Learn Interactively
Lesson: Code for the Amazon Locker Service - Grokking the Low Level Design Interview Using OOD Principles

Hi @Udit_Kalani,

Thanks for highlighting this.
We’ve made the required change in the Package class.

Happy Learning :slight_smile: