Subtyping

Definition & Meaning

Last updated 23 month ago

What Is Subtyping?

SubtyPing is a perception in Programming Language principle wherein a subtype, that's a statistics kind, is associated with a supertype based on the notion of substitutability, in which program elements inclusive of features and subroutines which can be written for the supertype will nonetheless operate if given the subtype as an alternative. Subtypes are an crucial idea in Object-orientated Programming and are substituTable to supertypes and occasionally actually have extra Stringent specifications than the supertype.

What Does Subtyping Mean?

Subtyping is a Method for substitution and Code reuse used in object-orientated programming languages to prEvent needless copying of largely comparable code and promote code clarity and save you insects. A subtype is essentially a substitute for a supertype which can satisfy all the latter’s specs, after which some. So if B is a subtype of A, then B can continually be used to replacement for an A and any property this is assured by means of A need to also be assured through B.

The subtype is authorized to reinforce and even add homes that aren't at the supertype, which means that it allows the supertype to be extended. So, as opposed to growing a brand new supertype on every occasion some thing new is required and then copying homes and conditions from some other supertype, a subtype ought to truly be created that extends the supertype with extra homes or capabilities with out cHanging the supertype. Then, in this example, the entirety that is provable to the supertype may also be provable to the subtype and more. If a subtype is treated basically the equal manner as the supertype by using using and Querying simplest supertype strategies and Fields, then the consequences could be consistent with objects of the supertype.

Share Subtyping article on social networks

Your Score to Subtyping article

Score: 5 out of 5 (1 voters)

Be the first to comment on the Subtyping

9532- V4

tech-term.com© 2023 All rights reserved