piece of code stl
来源:互联网 发布:网络商品直销 编辑:程序博客网 时间:2024/04/27 21:22
#include <iostream>
using namespace std;
class Base{};
class Dri1: public Base{};
class Dri2: public Base{};
class Gra: public Dri1, Dri2{};
template <class I>
void print(I&, Base)
{
cout << "Using Base" <<endl;
return;
}
template <class I>
void print(I&, Dri1)
{
cout << "Using Dri1" << endl;
return;
}
template <class I>
void print(I&, Dri2)
{
cout << "Using Dri2" << endl;
return;
}
template <class I>
void print(I&, Gra)
{
cout << "Using Gra" << endl;
return;
}
int main()
{
int a = 8;
print(a, Base());
print(a, Dri1());
print(a, Dri2());
print(a, Gra());
using namespace std;
class Base{};
class Dri1: public Base{};
class Dri2: public Base{};
class Gra: public Dri1, Dri2{};
template <class I>
void print(I&, Base)
{
cout << "Using Base" <<endl;
return;
}
template <class I>
void print(I&, Dri1)
{
cout << "Using Dri1" << endl;
return;
}
template <class I>
void print(I&, Dri2)
{
cout << "Using Dri2" << endl;
return;
}
template <class I>
void print(I&, Gra)
{
cout << "Using Gra" << endl;
return;
}
int main()
{
int a = 8;
print(a, Base());
print(a, Dri1());
print(a, Dri2());
print(a, Gra());
return 0;
}
===========================================================================================================================================
Using Base
Using Dri1
Using Dri2
Using Gra
- piece of code stl
- piece of code stl (2)
- piece of code(2)
- piece of code(3)
- piece of code(4)
- piece of code about std
- code piece
- code piece.
- code piece
- How to disable compiler optimization for a piece of code
- Insert Code piece Test
- Piece of Cake
- A Piece Of My Heart
- A piece code for backtrace in MIPS
- A piece code for backtrace in MIPS
- Win32/FakeSecSen - A Nasty Piece of Work
- do you want a piece of me
- SpokenEnglish--It's a piece of cake
- Google 地图 API V3 之事件
- Android 客户端与ssh 服务端通信 以对象的形式相互传 (二) 客户端从服务端请求对象
- 关系键
- 旧代码 - 高精度阶乘
- Response.Redirect()和Server.Transfer()的传值方式?
- piece of code stl
- c#图像灰度化、灰度反转、二值化
- 函数 -- Javascript语言精粹
- 用PHP函数memory_get_usage获取当前PHP内存消耗量 .
- The server does not support version 3.0 of the J2EE Web module specification
- Session,SessionFactory,Translation的详解
- 数据库触发器
- 匹配追踪(Matching pursuit,MP)
- cocos2d-x闯关类游戏源码