virtual-functions
Pure Virtual Methods with Different Datatypes
I\'m making a base class for my container classes to derive from so I can maintain a consistent interface.It currently looks something like this:[详细]
2023-02-25 06:15 分类:问答virtual function with user-defined-type vector
I want to define an abstract base class with a vector of struct variables, and a virtual function to be implemented by deri开发者_如何学编程ved classes:[详细]
2023-02-24 21:37 分类:问答C++: Is "Virtual" inherited to all descendants
Assume the following simple case (notice the location of virtual) class A { virtual void func(); }; class B : public A {[详细]
2023-02-23 15:55 分类:问答Changing abstract method signatures in inherited classes
Imagine I have a class called Engine as an abstract base class. I also have ElectrictEngine and FuelEngine classes which derive from it.[详细]
2023-02-22 21:12 分类:问答SEGFAULT - On C++ pure virtuals. Why?
I am passing a pure-virtual base class pointer arround through C code as a void *. When I dereference the base class in C++, the debugger is able to access all of its members. However, when I attempt[详细]
2023-02-22 06:12 分类:问答Virtual functions versus Callbacks
Conside开发者_运维技巧r a scenario where there are two classes i.e. Base and Derived. If the Base class wants to call a function of the derived class, it can do so by either making a virtual function[详细]
2023-02-22 04:59 分类:问答Position-independent code and vtable
How are virtual functions implemented in position-independent code? I know that if my class has virtual functions, the compiler usually generates a vtable for it that contains addresses of all virtua[详细]
2023-02-17 22:50 分类:问答What are the rules for virtual function lookup?
#include <iostream> class base { public: virtual void print (int a) { std::cout << \"a: \" << a << \" base\\n\";[详细]
2023-02-17 20:43 分类:问答What's the issue with malloc() and virtual functions? [duplicate]
This question already has answers here: Closed 11 years ago. Possible Duplicate: C++: why is new needed?[详细]
2023-02-16 18:42 分类:问答in c++ when subclassing why sometimes need to add virtual keyword to overridden function?
Why do I sometimes see in C++ examples when talking about subclassing / inheritance, the base class has virtual keyword and sometimes the over开发者_如何转开发ridden function has also the virtual keyw[详细]
2023-02-16 17:53 分类:问答