Link to home
Start Free TrialLog in
Avatar of wwwcom
wwwcom

asked on

what is strongly typed language means

what is strongly typed language means
ASKER CERTIFIED SOLUTION
Avatar of srilankan
srilankan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ozo
Everything has a type that is known at compile time
Avatar of wwwcom
wwwcom

ASKER

thanx
The language which does not allow implicit conversion from one type to other.  All types are treated exact.  
>> anguese in which that all the type dismatching errors can be determined.
Weakly typed languages can have type missmatch errors too.

>> Everything has a type that is known at compile time
That is true of weakly typed languages too.

>> does not allow implicit conversion from one type to other
C++ has lots of instances where it performs implicit conversions, yet it is strngly typed.

In a strongly typed language, objects (varaibles) of different data types usually can not be used interchangably.  So for example, if in a particular instance, if the compiler expects an object of a certain type to be used, it will refuse to compile code that uses any other data type, not matter how similar that data type is.  If possilbe the compiler might perform an implicit conversion from the specified data type to the data type it expects.  But, if that coversion is possible it will be performed, in other words the compiler will end up having the data type it expects, not the one specified.   In a weakly typed language this tends to not be true.  Objects of different types often can be used interchangable as long as they satisfy certain restrictions, like they might need to provide a particular interface.  

For example the two classes.

class Point
{
   int x;
   int y;
};

class Coordinate
{
   int x;
   int y;
};

In C++ these classes are completely distinct.  They are not interchangable in any way.  this would tend to be true of any strongly typed language.  But in a weakly typed language they might be interchangable as long as you didn't use them in a way that makes use of their differences (which in this case there are no differences).