55. Type Aliases

Question.4

A developer creates semantic type aliases for safety:

using Voltage = int;
using Current = int;

void set_voltage(Voltage v);

Current i = 500;
set_voltage(i);  // Pass Current to Voltage parameter

Does the compiler catch this mistake?

Need Help? Refer to the Quick Guide below

Select Answer