Generic Programming with Templates:

Slides:



Advertisements
Similar presentations
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Advertisements

Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 9 Classes.
Modularity. Methods & Class as program unit A method is comprised of statement sequences and is often viewed as the smallest program unit to be considered.
1 Software Testing and Quality Assurance Lecture 20 – Class Testing Basics (Chapter 5, A Practical Guide to Testing Object- Oriented Software)
Contemporary Information Systems Development Chapter 10.
An Introduction to Design Patterns Brian Ordona. Programming: Constantly Searching for the Holy Grail  “There’s got to be a better way to do this!” 
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Themes and Variations abstraction -- the object metaphor modeling -- understanding.
Object Oriented Programming
Object Oriented Software Development
BCS 2143 Introduction to Object Oriented and Software Development.
1 CS 456 Software Engineering. 2 Contents 3 Chapter 1: Introduction.
PRESENTED BY: RAJKRISHNADEEPAK.VUYYURU SWAMYCHANDAN.DONDAPATI VINESHKUMARREDDY.LANKA RAJSEKHARTIRUMALA KANDURI ALAN.
Chapter 6 Object-Oriented Java Script JavaScript, Third Edition.
CSC480 Software Engineering Lecture 11 September 30, 2002.
Object Oriented Software Development
Learners Support Publications Object Oriented Programming.
Java Fundamentals Usman Ependi UBD
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (2/2)
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
PRG 420 Week 1 DQ 1 Java™ is a portable language, and being an object-oriented programming language, it also encourages component reusability. How does.
Prof. Bhushan Trivedi Director GLS Institute of Computer Technology
Motivation for Generic Programming in C++
OOP - Object Oriented Programming
Design Patterns: MORE Examples
Leverage your Business with Selenium Automation Testing
Unit II-Chapter No. : 5- design Patterns
Visit for more Learning Resources
Object Oriented Programming
Strategy Design Pattern
Mastering Autodesk Revit MEP 2016
STAAD.Pro v8i  Training Let’s get started!.
Factory Patterns 1.
Systems Analysis and Design With UML 2
Objects as a programming concept
Design Patterns Introduction
Design Patterns Damian Gordon.
Intent To provide a framework to manage the process of software salvage and promote loose coupling through message passing. Salvage means recycling significant.
Software Design and Architecture
OOP What is problem? Solution? OOP
Software Design and Architecture
Object Oriented Concepts -I
Rapid Application Development Model
Lecture 2 of Computer Science II
Object-Orientated Programming
Generic programming – Function template
object oriented Principles of software design
Object Oriented Concepts
UML: Unified modeling language
Using local variable without initialization is an error.
OOPS Oops in java and how its works. Advantages of oops ●The procedural-arranged dialects center around methodology, with work as the essential unit.
Object Oriented Analysis and Design
OOP vs Structured Programming
Introduction to Systems Analysis and Design
OBJECT-ORIENTED PROGRAMMING
Currency Swaps. 1Meaning CurrencySwapsrefertothearrangementwhereprincipaland interestpaymentsinonecurrencyisexchangedforsuch paymentsinanothercurrency.
Software Design Lecture : 15.
Software Design Lecture : 14.
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Programming Languages
Authors: Barry Smyth, Mark T. Keane, Padraig Cunningham
Lesson 5: More on Creational Patterns
Introduction to Object-Oriented Programming
Unit 6 part 5 Test Javascript Test.
CSCI 130 Classes and Objects.
Oriented Design and Abstract Data Type
FRAMEWORKS AND REUSE What is “Framework”?
Abstract Types Defined as Classes of Variables
Presentation transcript:

Generic Programming with Templates: A significant benefit of object oriented programming is reusability of code which eliminates redundant coding An important feature of C++ called templates strengths this benefit of OOP and provides great flexibility to the language Templates support generic programming, which allows to develop reusable software components such as functions, classes, etc.., supporting different data types in a single framework. For instance, functions such as sort, search, swap etc.., which support various data types can be developed.

A template in C++ allows the construction of a family of template functions (function templates) and classes (class templates) to perform the same operation on different data types. They perform appropriate operations depending on the data type of parameters passed to them. It allows a single template to deal with a generic data type T.

Function Templates: There are several functions of considerable importance which have to be used frequently with different data types. The limitations of such functions is that they operate only a particular data type. It can be overcome by defining that function template or generic function. A function template specifies how an individual functions can be constructed.

Disadvantage: