Virtual function:Virtual function is a member function which is declared within a base class and is redefined by a derived class.
Inline function:Inline function is a normal function which is defined by the keyword inline, it is a short function which is expanded by the compiler and its arguments are evaluated only once.
The syntax of defining the function inline in C++ is:
inline return-type function-name(parameters)
{
// function code
}
Difference between virtual function and inline function are as follows:
Virtual function
Inline function
1. Virtual function must be declared in public section of class.1. Inline function is a normal function which is defined by the keyword inline.2. Virtual function cannot be static.2. Inline function can also be non-static.3. Virtual function is defined in base class.3. Inline function are the short length functions that are automatically made the inline functions without using the inline keyword inside the class.4.
#c++ #difference between #c++-virtual functions