Wednesday, February 8, 2012

Templates

There are two different types of templates in C++ language i.e.’ function templates
and class templates. Before going ahead, it will be sagacious to know what a template
is? You have used a lot of templates in the childhood. There are small scales being
marketed at the stationary shops having some figures on them like circle, a square,
rectangle or a triangle. We have been using these articles to draw these shapes on the paper. We put the scale on the paper and draw the lines with the pencil over that figure to get that shape. These engraved shapes are generally called stencils. But in a way, these are also templates. We may also take these ‘cut-outs’ as sketches. So a template is a sketch to draw some shape or figure. While drawing a special design, say of furniture, we develop a template for this, which is not an actual piece of furniture. We try that its shape should be like the outline. Later,the cut out prepared out of wood in line with the template, is actual piece of furniture. We can think of making a triangular template and then drawing it on a piece of wood and shaping it into a triangle. We can use the same template and put it on a piece of metal and can cut it into a triangle and so on. In a way, that template is allowing us the reuse of a certain shape. This is the concept we are going to try and build on here.

No comments:

Post a Comment