The keyword inline lets the compiler know that it need not create separate stack space for the function. Instead whenever the compiler finds the function-call, it will replace it with the function body directly thus making the function-call faster (so, for functions whose bodies are maybe a line or two - i would use the inline keyword). The keyword virtual simply means that you can implement the same function in another class, which inherits from this class, with a different implementation (polymorphism). So, you can have inline virtual functions, and I tend to write them as shown in the following example:
class A
{
private:
int a;
public:
virtual int getVal();
};
inline int A::getVal() { return a; }
another example would be:
class A
{
private:
int a;
public:
virtual int getVal() { return a; }
};
In the second example, the getVal() function is by default an inline function, since it has been declared and defined in the class declaration, so there is no need for the keyword inline - I'm not very sure about this statement, but this is what I think happens, so I would like to be corrected if I'm wrong.
Andyrau