Polymorphism (Virtual Functions)

i have a question, when you define for example a virtual void parameterless function with name "F" in a class, and then you make a number of subclasses under this class and put inside each of them void parameterless function with name "F" without putting virtual keyword in them, will they anyway be virtual because the function with the same name of their superclass is virtual ?
Last edited on
Yes (assuming by subclass you meant derived class). The use of the keyword virtual before functions in derived classes that have an identical signature to a virtual function in the base class is optional.
Topic archived. No new replies allowed.