7-More Overloading

7-More Overloading - template< class T> void Abc(T...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std; //void Abc() { cout << "Hello";} //void Abc(int x) { cout << "World";} //void Abc(int y = 1) { cout << "Goodbye" << y << endl;} // Supports Abc() && Abc(int) //void Abc(float y = 1) { cout << "Good Day" << y << endl;} // Supports Abc() && Abc(float) template < class T > void Abc(T first) { cout << "Template\n";
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } template < class T > void Abc(T first, T second) { cout << "It takes two\n"; } int main (void) { int number = 0; //Abc(); Abc(6); Abc(4.5f); Abc(4.5); Abc(1, 2); do { cout << "Give me a number: "; cin >> number; cout << "Your number is " << number << endl; cin.clear(); cin.ignore(); }while (false);//(number == 0); return 0; }...
View Full Document

This note was uploaded on 10/05/2011 for the course CS 37 taught by Professor Glenncuevas during the Summer '09 term at Irvine Valley College.

Ask a homework question - tutors are online