The keyword virtual indicates that

a derived class has public access to a base class
more than one base class exists
a base class should be used only once in inheritance
a derived class should have more than one base class constructed

The correct answer is: A. a derived class has public access to a base class.

The keyword virtual is used to declare a member function as virtual. A virtual function is a function that can be overridden in a derived class. When a virtual function is called from a pointer or reference to a base class object, the derived class’s version of the function is called, not the base class’s version.

Option B is incorrect because the keyword virtual does not indicate that more than one base class exists. A derived class can have multiple base classes, but the keyword virtual is not required for this.

Option C is incorrect because the keyword virtual does not indicate that a base class should be used only once in inheritance. A base class can be used multiple times in inheritance, but the keyword virtual is not required for this.

Option D is incorrect because the keyword virtual does not indicate that a derived class should have more than one base class constructed. A derived class can have multiple base classes, but the keyword virtual is not required for this.

Exit mobile version