mirror of
https://github.com/szymon-jozef/ZUT-notatki.git
synced 2026-10-28 11:10:38 +01:00
bla bla
This commit is contained in:
11
uczelnia/2_semestr/programowanie/laby/lab12/zad8.cpp
Normal file
11
uczelnia/2_semestr/programowanie/laby/lab12/zad8.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
// Fragment A
|
||||
template <typename T> T podwoj(T x) { return x + x; }
|
||||
podwoj(2, 3); // funkcja przyjmuje jeden argument a jest wywołana z dwoma
|
||||
|
||||
// Fragment B
|
||||
template <typename T> T iloczyn(T a, T b);
|
||||
// definicja w innym pliku .cpp - kod się nie linkuje
|
||||
|
||||
// Fragment C
|
||||
template <typename T> T wiekszy(T a, T b) { return a > b ? a : b; }
|
||||
wiekszy("abc", 5); // musi być dwa razy ten sam typ danych, a nie dwa różne
|
||||
Reference in New Issue
Block a user