Best way of returning a derived class pointer from a class working on a set of base class pointers
I have an abstract Base
class and multiple derived classes from that Base
class, representing different kinds of objects all having the same property of weight.
Best way of returning a derived class pointer from a class working on a set of base class pointers
I have an abstract Base
class and multiple derived classes from that Base
class, representing different kinds of objects all having the same property of weight.
Best way of returning a derived class pointer from a class working on a set of base class pointers
I have an abstract Base
class and multiple derived classes from that Base
class, representing different kinds of objects all having the same property of weight.
Best way of returning a derived class pointer from a class working on a set of base class pointers
I have an abstract Base
class and multiple derived classes from that Base
class, representing different kinds of objects all having the same property of weight.
Best way of returning a derived class pointer from a class working on a set of base class pointers
I have an abstract Base
class and multiple derived classes from that Base
class, representing different kinds of objects all having the same property of weight.
Best way of passing back derived class pointer result from a class working on a set of base class pointers
I have an abstract Base
class and multiple derived classes from that Base class representing different kinds of objects all having the same property of weight. The purpose of the Selector
class is to select an object from the passed collection of (homogeneous) objects based on some algorithm that will use the weight (via getWeight
API) as the input. The number of derived classes from Base
will continue to increase in the future, and the Selector
algorithm itself can also evolve, but the input parameters will remain unchanged.
Best way of passing back derived class pointer result from a class working on a set of base class pointers
I have an abstract Base
class and multiple derived classes from that Base class representing different kinds of objects all having the same property of weight. The purpose of the Selector
class is to select an object from the passed collection of (homogeneous) objects based on some algorithm that will use the weight (via getWeight
API) as the input. The number of derived classes from Base
will continue to increase in the future, and the Selector
algorithm itself can also evolve, but the input parameters will remain unchanged.
How does C++ select the `delete` operator in case of replacement in subclass?
Let’s assume I have the following code (https://godbolt.org/z/MW4ETf7a8):
How C++ selects the `delete` operator in case of replacement in subclass?
Let’s assume I have the following code ( https://godbolt.org/z/MW4ETf7a8 )
How to call derived type methods from vector of base type stored in a different class?
say I have some class foo that has a vector of pointers to another class Bar and a LogBarVec() method that logs each Bar’s internal type: