







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth exploration of various aspects of object-oriented programming (oop), focusing on template specializations, function templates, and non-type parameters. Explicit and partial specializations, member templates, and non-type parameter defaults. Students will gain a solid understanding of these concepts through examples and explanations.
Typology: Slides
1 / 13
This page cannot be seen from the preview
Don't miss anything!








template< class T > template< class T >
class Vector { }; class Vector { };
template< class T > template< class T >
class Vector< T* > { }; class Vector< T* > { };
template< class T > template< class T >
class Vector { }; class Vector { };
template< > template< >
class Vector< char* > { }; class Vector< char* > { };
template< typename T > template< typename T > bool isEqual( T x, T y ) { bool isEqual( T x, T y ) { return ( x == y ); return ( x == y ); } }
template< typename T > template< typename T > bool isEqual( T* x, T* y ) { bool isEqual( T* x, T* y ) { return ( *x == *y ); return ( *x == *y ); } }
template< class T > template< class T >
Array
if (size > 0) if (size > 0) ptr = new T[size]; ptr = new T[size]; else else ptr = NULL; ptr = NULL;
} }
template< class T, int SIZE > template< class T, int SIZE > class Array { class Array { private: private: T ptr[SIZE]; T ptr[SIZE]; public: public: Array(); Array(); … … }; };
template< class T = int > template< class T = int > class Vector { class Vector { … … } }
Vector< > v; Vector< > v; // Vector< int > v;// Vector< int > v;