Project3-Q2 - #include u using namespace std...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> using namespace std; u template <class ItemType> //this is the class template for class T class T { public: T(ItemType value1, ItemType value2, ItemType value3); //class constructor ~T(); //class destructor inline void Swap(ItemType *item1, ItemType *item2); //Swap function //I wasn't sure if I needed inline here. I don't know much about it. //I've read about it only briefly, but I wanted to play it safe. private: ItemType value1, value2, value3; //declaration of 3 private data members }; } template<class ItemType> T<ItemType>::T(ItemType value1, ItemType value2, ItemType value3) //Implementation of the default constructor { value1=0; value2=0; value3=0; } template<class ItemType> T<ItemType>::~T() //Implementation of the default destructor { value1=0; value2=0; value3=0; } template<class ItemType> inline void T<ItemType>::Swap(ItemType *item1, ItemType *item2) //Implementation of the Swap function. Takes two pointers as parameters //and swaps their values regardless of their "data type"
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

Project3-Q2 - #include u using namespace std...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online