give an example of enforcement in typingyou can


Give an example of enforcement in Typing.

You can understand the idea of enforcement as it makes sure objects of dissimilar classes may not be interchanged as below:

 Example: Fruit f; Vegetable v; Mango m;  

This implies 'v' is variables of class Vegetable, 'm' of class Mango and 'f' of class Fruit. Typing ensures that value of 'f' never be assigned to 'v'.

However, if Mango extends Fruits, then 'f' may be assigned a value of 'm'. The variable of a sub class may be assigned to variable of super class, but not other way around while 'm' cannot be assigned a value of 'f'.

 

Request for Solution File

Ask an Expert for Answer!!
Database Management System: give an example of enforcement in typingyou can
Reference No:- TGS0353618

Expected delivery within 24 Hours