若在逻辑上 B 是 A 的“一种”(a kind of ),则允许 B 继承 A 的功 能和属性。

例如男人(Man)是人(Human)的一种,男孩(Boy)是男人的一种。

那么类 Man 可以从类 Human 派生,类 Boy 可以从类 Man 派生。

 #include <iostream>
#include<string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
//显示数组的函数模板
template <class T> void arr_put(T arr[],int size) {
for (int i= ;i<=size;i++)
cout<<arr[i]<<" ";
cout<<endl;
} //选择排序数组的函数模板
template <class T> void sort(T arr[],int size) {
T temp;
int i,j;
for (i=;i<size;i++)
for (j=i+;j<=size;j++)
if (arr[i]<=arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
} int main(int argc, char** argv) {
//用排序函数模板处理int型数组
cout<<"int:"<<endl;
int a[]={,,,,,,,-};
arr_put(a,);
sort(a,);
arr_put(a,); //用排序函数模板处理double型数组
cout<<"double:"<<endl;
double x[]={1.2,2.1,1.414,1.732};
arr_put(x,);
sort(x,);
arr_put(x,); //用排序函数模板处理char类型数组
cout<<"char:"<<endl;
char str[];
cout<<"str:";
cin>>str;
int size=strlen(str);
arr_put(str,size);
sort(str,size);
arr_put(str,size);
return ;
}

最新文章

  1. Office2013插件开发Outlook篇(1)-- 第一个office2013插件
  2. ssh设置
  3. POJ3744Scout YYF I(求概率 + 矩阵快速幂)
  4. Housse Robber II | leetcode
  5. Unreal Engine 虚幻引擎宣布对开发者免费
  6. Codeforces Gym 100610 Problem A. Alien Communication Masterclass 构造
  7. [转]ASP.NET MVC Jquery Validate 表单验证的多种方式介绍
  8. VS中使用sqlite静态连接
  9. Linux下high CPU分析心得【非原创】
  10. linux常用命令(自我积累)
  11. java 面对对象(抽象 继承 接口 多态)
  12. phpStorm 新建文件SVN不提交的解决的方法
  13. SSH服务端配置、优化加速、安全防护
  14. 理解Python迭代对象、迭代器、生成器
  15. python 玩耍天地
  16. Spark基础-scala学习(四、函数式编程)
  17. JVM中对象的回收过程
  18. vue里router-link标签设置动态路由的3个方法
  19. 2018.07.22哨戒炮 II(树形dp)
  20. MySQL复制 -- 复制出错怎么办?

热门文章

  1. it-tidalwave-semantic-aux-1.0.13.jar下载
  2. Autofac3 在MVC4中的运用原理
  3. 模拟登陆百度 python
  4. python字符串操作大全
  5. docker sshd image problem, session required pam_loginuid.so, cann&#39;t login
  6. iOS-仿智联字符图片验证码
  7. 【LeetCode】73. Set Matrix Zeroes (2 solutions)
  8. jquery切换class
  9. 网页调用本地程序(Windows下浏览器全兼容)
  10. connect: Network is unreachable解決方法