9 ms·
> and then swapping in a language in which 1 and 1.0 do not quack Except, no. This compiles and evaluates just fine in C++. Both quack the same quack. int
by randomdata 2y ago
> and then swapping in a language in which 1 and 1.0 do not quack
Except, no. This compiles and evaluates just fine in C++. Both quack the same quack.
int x = 1;
float y = 1;
x > y;
The previously provided code fails because of the use of typename, which explicitly calls for the compiler to evaluate the type based on name. That is literally the documented purpose of the keyword. And which is exactly what duck typing is not. Duck typing doesn't need a duck to actually be a duck. If a goose walks and quacks like a duck... Close enough — it is a duck!
> Anyway, your confusion may be easily resolved by perusing the following link.
Imagine having such little understanding of what you are talking about that you can't do it and have to defer to the work of others. Why even bother participating in a discussion if you can't speak to it yourself? It is especially humorous when that work of someone else doesn't even state what it is purported to.