I used to know that C++ is a statically typed language, but the newer C++ specification introduces a newer syntax auto
which can determine the variable type by itself. So can C++ still be considered as a statically typed language?
No, this does not make C++ a dynamically typed language. auto
is just a compile-time type inference method. The resulting code is exactly the same as without auto
and the type cannot change at run-time.
C++ is still a statically typed language with the auto type specifier because auto denotes that the type will be inferred by the compiler at compile time. Rather then at run time in dynamically typed languages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With