Overloading with Different Data Types

Easy Polymorphism & Function Overloading
Solve in Playground →

Problem Statement

Create a `Math` class with two overloaded `multiply` methods. One takes two `int` parameters and returns an `int`. The other takes two `double` parameters and returns a `double`. Read two ints and two doubles from input, multiply them using the class, and print the results.

Input Format

Four space-separated numbers: int1, int2, double1, double2.

Output Format

Print 'Int Result: [val]' and 'Double Result: [val]'.

Constraints

None

Sample Input

3 4 2.5 4.0

Sample Output

Int Result: 12
Double Result: 10

Explanation

Overloading by data type enables the same logical operation (multiplication) to adapt natively to different underlying primitives.

Starter Code

#include <iostream>

class Math {
public:
    // Write your overloaded multiply methods here
};

int main() {
    // Read input and output results
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used