polymorphism

Swashbuckle polymorphism support issue

最后都变了- 提交于 2020-12-12 11:56:32
问题 I am using Swashbuckle v3.0. I am not sure weather this is a bug or not, but polymorphism is not working as it should. I have the following classes: BasePersonDocumentDto { Id, Number } IdentityDto: BasePersonDocumentDto { } PassportDto: BasePersonDocumentDto { VisaNumber } To apply Inheritance & Polymorphism, i have created a schema and document filters. I followed this answer Below are the code i used. public class PolymorphismSchemaFilter<T> : ISchemaFilter { private List<Type>

Why do I need to redeclare overloaded virtual functions?

纵然是瞬间 提交于 2020-11-29 09:35:40
问题 I have a base class with two overloaded functions f(void) and f(int) . The class Derived implements f(int) by calling f(void) . Derived2 implements f(void) only. The compiler rejects the implementation Derived::f(int) because it wants to call f(int) but I provided no arguments because I want to call f(void) . Why does the compiler reject it? Why does adding the line virtual int f(void) = 0; fix my problem? class Base { public: explicit Base(void) {} virtual ~Base(void) {} virtual int f(void)

Why do I need to redeclare overloaded virtual functions?

自作多情 提交于 2020-11-29 09:34:08
问题 I have a base class with two overloaded functions f(void) and f(int) . The class Derived implements f(int) by calling f(void) . Derived2 implements f(void) only. The compiler rejects the implementation Derived::f(int) because it wants to call f(int) but I provided no arguments because I want to call f(void) . Why does the compiler reject it? Why does adding the line virtual int f(void) = 0; fix my problem? class Base { public: explicit Base(void) {} virtual ~Base(void) {} virtual int f(void)