// Online C++ compiler to run C++ program online #include <iostream> struct Base { virtual void print_val() { std::cout << val << std::endl; } double val; int num; }; struct A final : Base { void print_val() final{ std::cout << val+1 << std::endl; } void print_num() // final // error: print_num not virtual { std::cout << num+1 << std::endl; } }; int main() { // Write C++ code here std::cout << "Hello world!"; return 0; }