Slow But Beginner Friendly|| Simplest solution
Approach
first create the vector
then create the constructor (to initialize the vector to an empty vector)
Now in void function push the numbers
Now in product

# Approach
<!-- Describe your approach to solving the problem. -->
- first create the vector
- then create the constructor (to initialize the vector to an empty vector)
- Now in void function push the numbers
- Now in product just computethe product of last k elements
- and now all done just return the product
# Please Upvote if it helps!! 🫠🙃🥺

# Code
```cpp []
class ProductOfNumbers {
public:
    vector<int>x;
    int n,a;
    ProductOfNumbers() {
        x={};    
    }
    void add(int num) {
        x.push_back(num); 
    }
    
    int getProduct(int k) {
        n=x.size();
        a=1;
        for(int i=0;i<k;i++){
            a=a*x[n-1-i];
        }
        return a;
        
    }
};

/**
 * Your ProductOfNumbers object will be instantiated and called as such:
 * ProductOfNumbers* obj = new ProductOfNumbers();
 * obj->add(num);
 * int param_2 = obj->getProduct(k);
 */
```
['C++']