4

I could not understand when we say c++ is strongly typed language when floats can be assigned to integer and when a function that is supposed to return string can also return bool as given below :

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

Can somebody enlighten me what we mean when we say c++ is strongly typed ?

PapaDiHatti
  • 1,841
  • 19
  • 26

0 Answers0