#include // for the stream std::cout #include // for the class std::string #include // for the class std::type_info int main() { /* * explicit static typing */ int x; x = 6; std::cout << "x is of the type " << typeid(x).name() << " and has the value " << x << ".\n"; std::string y; y = "Hello World"; std::cout << "y is of the type " << typeid(y).name() << " and has the value " << y << ".\n"; /* * implicit static typing */ // auto z; -> not allowed! auto z = x; std::cout << "z is of the type " << typeid(z).name() << " and has the value " << z << ".\n"; /* * dynamic typing is not possible in C++, * neither is it possible to alter a type at runtime */ // x = y; -> not allowed // z = y; -> not allowed }