This could work in two scenarios:
- When
A
is a B
, i.e. inheritance or interface implementation, or
- When
A
and B
are primitive data types, and an implicit conversion exists from A
to `B.
Here is an example:
void m(long b) {
...
}
int a = 123;
m(a); // This compiles and runs correctly