QT乱翻书-重载
作者:互联网
QT乱翻书-重载
1 #include <iostream> 2 3 using namespace std; 4 /* 5 函数重载 是静态多态特性。 6 用一个函数名 代表 多个不同函数的功能。 7 函数重载的条件: 8 参数个数、顺序、类型不同的同名函数 9 返回值不同不构成重载 10 */ 11 12 void printFun(int a) 13 { 14 cout << "int" << endl; 15 } 16 17 18 void printFun(int a, char b) 19 { 20 cout << "int char" << endl; 21 } 22 23 void printFun(char a, int b) 24 { 25 cout << "char int" << endl; 26 } 27 28 29 void printFun(char a) 30 { 31 cout << "char" << endl; 32 } 33 34 35 void test01() 36 { 37 printFun(10); 38 printFun(10, 'c'); 39 printFun('c', 10); 40 printFun('c'); 41 } 42 43 int main() 44 { 45 test01(); 46 cout << "Hello World!" << endl; 47 return 0; 48 }
标签:函数,不同,翻书,跳转,重载,QT 来源: https://www.cnblogs.com/kanbuxiaqu/p/15519406.html