#include <iostream>
using namespace std; template<class T>
class MyClass{
private:
T value;
public:
void assign(const MyClass<T> & obj)
{
this->value=obj.value;
} MyClass(T value)
{
this->value=value;
}
}; template<class T>
class MyClass2{
private:
T value;
public:
template<class X>
void assign(const MyClass2<X> & obj)
{
this->value=obj.getValue();
} MyClass2(T value)
{
this->value=value;
} T getValue() const
{
return this->value;
}
}; void main()
{
MyClass<double> d(2.3);
MyClass<double> i();//MyClass<int> i(5);
d.assign(i); MyClass2<double> d2(2.3);
MyClass2<int> i2();
d2.assign(i2); }

member_template_function的更多相关文章

随机推荐

  1. IUrlHelper ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of ...

  2. RabbitMQ入门详解以及使用

    目的: RabbitMQ简介 RabbitMQ安装及使用 Centos安装 Docker安装(今天选择Docker安装方法) RabbitMQ快速入门 交换机 RabbitMQ简介 各大主流中间件对比 ...

  3. CentOS7安装rabbitmq集群(二进制)

    一.RabbiMQ简介 RabbiMQ是用Erang开发的,集群非常方便,因为Erlang天生就是一门分布式语言,但其本身并不支持负载均衡. RabbiMQ模式 RabbitMQ模式大概分为以下三种: ...

  4. @PropertySouce注解 读取 properties文件

    https://www.cnblogs.com/whx7762/p/7885735.html 1.@ProtertySource @PropertySouce是spring3.1开始引入的基于java ...

  5. java之spring mvc之页面跳转

    1. 如果返回值为ModelAndView,在处理方法中,返回null时,默认跳转的视图名称为请求名.跳转结果会根据视图解析器来跳转. @RequestMapping("/hello.do& ...

  6. npm和Node.js简介

    Node.js Node.js是JavaScript的一种运行环境,是对Google V8引擎进行的封装.是一个服务器端的javascript的解释器.Node.js允许通过JavaScript和一系 ...

  7. csdn 分享私藏的18个黑科技网站,想找什么软件就找什么软件!!!

    https://blog.csdn.net/sinat_33921105/article/details/103307419 1.NO.1–胡萝卜周 http://www.carrotchou.blo ...

  8. SVN 报错 Can't install '*' from pristine store, because no checksum is recorded for this file

    SVN同步.cleanup都会出现下面的提示: svn: E155017: Can't install '*' from pristine store, because no checksum is ...

  9. Python学习笔记-字符串与注释

    OSX从Pthon 2.7升级到3.8 1,官网下载最新安装包安装 2,执行认证文件command 3,执行设置path command 4,设置默认python 在terminal里运行open   ...

  10. 【WPF】EntityframeworkCore Update注意事项

    The instance of entity type 'Book' cannot be tracked because another instance with the same key valu ...