tailieunhanh - Lecture Object oriented programming - Lecture no 26

The topics discussed in this chapter are: Object-oriented programming overview, UML class diagram, first OOP class, private and public access, driver class, reference variables and instantiation, calling a method, calling object. | CSC241: Object Oriented Programming Lecture No 26 Previous Lecture Intro to Generic Programming Template Function template – single template argument Today’s Lecture Functional templates Example program multiple arguments Macros vs template Class templates Example program Write a program that can sort int, float, double, character type of array in ascending order and then display it. Write a program Function Templates – Multiple Arguments Suppose a function to search an array for a specific value This function takes three arguments: two that are template arguments one of a basic type Function returns the array index for that value if it finds it, or –1 if it can’t find it template int find(atype* array, atype value, int size) { for(int j=0; j int find(atype* array, atype value, int size) { for(int j=0; j

TÀI LIỆU LIÊN QUAN
TỪ KHÓA LIÊN QUAN