Resolve Driver Collision

#include <iostream>
using namespace std;

namespace DriverA{
    void init(){
        cout<<"A INIT";
    }
}

namespace DriverB{
    void init(){
        cout<<"B INIT";
    }
}
// Create namespaces DriverA and DriverB here

int main() {
    int x;
    cin >> x;
    if(x==1){
       DriverA::init(); 
    }

    if(x==2){
        DriverB::init();
    }
    // Call correct namespace function here

    return 0;
}

Solving Approach

 

 

 

 

Upvote
Downvote
Loading...

Input

1

Expected Output

A INIT