Show the output of the following code.
```
#include
using namespace std;
class Parent
{
public:
virtual void f()
{
cout << "invoke f from Parent" << endl;
}
};
class Child: public Parent
{
public:
void f()
{
cout << "invoke f from Child" << endl;
}
};
void p(Parent a)
{
a.f();
}
int main()
{
Parent a;
a.f();
p(a);
Child b;
b.f();
p(b);
return 0;
}
```
invoke f from Parent
invoke f from Parent
invoke f from Child
invoke f from Parent
You might also like to view...
Answer the following statements true (T) or false (F)
1. A struct variable is declared differently from a predefined type such as an int. 2. Two different structure definitions may have the same member names. 3. A structure can only be passed to a function as a call-by-value parameter 4. A function may return a structure. 5. Different class may not have member functions with the same name.
The easiest way to create a simple query is to use the Simple Query ________
Fill in the blank(s) with correct word
Microsoft's Internet Explorer 10 is the web browser software included with Windows 8.1
Indicate whether the statement is true or false
The ____ model is the most fundamental process model used to build software.
A. XP B. CLASP C. AOP D. waterfall