Why is C ++ called a strongly typed language?

I could not understand when we say that C ++ is a strongly typed language, when a float can be assigned to an integer, and when a function that should return a string can also return bool, as follows:

const std::string testfunc()
{
    float x =9.0;
    int y = x;
    return false;
}
int main()
{
  std::cout<<testfunc()<<std::endl;   
  return 0;
}

Can someone enlighten me, what do we mean when we say that C ++ is strongly typed?

+4
source share

Source: https://habr.com/ru/post/1676112/


All Articles