LogiQuest
Back to Polymorphism and Virtual Functions
12

What will be the output of the program?

#include <iostream>
using namespace std;
int area(int s) { return s * s; }
double area(double r) { return 3 * r * r; }
int main() {
    cout << area(2) << " " << area(2.0) << endl;
    return 0;
}
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.