How can I pass an Object of type Push
or Pull
into an Object of type Object Pool
?
I am simulating an Object Pool
in C++. I've made a function called Request()
which can receive a Parameter of either Pull
or Push
.
Is it possible? And if so, how?
Thank you in advance.
Here is the code example:
template <class T>
class ObjectPool {
public:
T Request(T* Object) {
// This is the part that seems unclear to me.
// Basically, in Pseudocode it looks like:
// if Object.type == Pull, then do:
// Steps to Generate an Object.
// else if Object.type == Push:
// Steps to store an Object.
}
ObjectPool() {
}
~ObjectPool() {
}
}