c++/over.cpp
author Markus Bröker<broeker.markus@googlemail.com>
Sun, 22 Oct 2017 22:55:27 +0200
changeset 172 43ae72f88d06
parent 165 f551b78c3eee
permissions -rw-r--r--
2er Komplement und integerToString

#include <iostream>
#include <cstdlib>

template<class T>
T add(T a, T b)
{
	return a+b;
}

int add (int a, int b)
{
	std::cout << "overloaded..." << std::endl;
	return b+a;
}

int main(int argc, char **argv)
{
	float a, b;
	int c, d;
    std::string s1, s2;

    a = 1.0;
    b = 2.5;

    c = 1;
	d = 2;

	s1 = "Hello ";
	s2 = "World!";

	std::cout << add (a, b) << std::endl;
	std::cout << add (c, d) << std::endl;
	std::cout << add (s1, s2) << std::endl;

	return EXIT_SUCCESS;
}