Generic type
functions
classes
दूसरे types (int, float, double आदि) से independent होते है। इसलिए जो data type आ parameter के रूप में pass करते है, generic function और class उसी type के बन जाते है। ऐसा करने से आपको हर data type के लिए अलग से functions और classes लिखने की आवश्यकता नहीं होती है और आपके program में unnecessary code नहीं होता है।
Templates के माध्यम से आप C++ में generic type functions classes create‹‹‹ है। Template classes और functions को parameters के साथ define किया जाता है। ये parameter actual data type
I replace कर दिया जाता है और फिर functions और
classes उसी type के बन जाते है।
Templates IN C++
Templates C++ का एक important feature Templates C++ generic programming की ability provide करते है। Generic programming में आप generic type के functions और classes create करते है।