Hi LuigiThanks, is there any tool or document to identify which class is abstract that I can use new to allocate memory?I'm working a wrapper program, which iterate all classes, hence it would be great to know which classes I can't do 'new' before compilingRegardsJerryOn Thu, Jan 12, 2017 at 7:33 PM, Luigi Ballabio <[hidden email]> wrote:A class is abstract when it (or one of its base classes) declares a pure virtual method and doesn't define it.In your case: CmsSpreadCouponPricer inherits from FloatingRateCouponPricer, which declares a bunch of virtual methods:virtual Real swapletPrice() const = 0;virtual Rate swapletRate() const = 0;virtual Real capletPrice(Rate effectiveCap) const = 0;virtual Rate capletRate(Rate effectiveCap) const = 0;virtual Real floorletPrice(Rate effectiveFloor) const = 0;virtual Rate floorletRate(Rate effectiveFloor) const = 0;virtual void initialize(const FloatingRateCoupon& coupon) = 0;so FloatingRateCouponPricer is abstract. CmsSpreadCouponPricer doesn't define them, so it's also abstract. LognormalCmsSpreadPricer inherits from CmsSpreadCouponPricer and defines them (that is, gives them actual bodies) so it's a concrete class and can be instantiated.For more details, you can probably check any C++ book.Cheers,LuigiOn Thu, Jan 12, 2017 at 4:52 AM Jerry Jin <[hidden email]> wrote:------------------------------------------------------------------------------Hello, QuantLib communityI'm getting error 'allocating an object of abstract class type error' sometimes while working with some classesFor example:return new CmsSpreadCouponPricer(correlation);How do I know which class is abstract and can't allocate memory?Thanks!RegardsJerry
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Free forum by Nabble | Disable Popup Ads | Edit this page |