【发布时间】:2014-07-01 16:38:20
【问题描述】:
在 WinRT 中构造类型时,explicit 关键字是否具有与标准 C++ 类型相同的功能和价值? IE。 WinRT ref 类型是否支持与标准 C++ 类型相同的隐式转换?
#pragma once
#include <collection.h>
#include <ppltasks.h>
using namespace Platform;
namespace RuntimeComponent2
{
public ref class Class1 sealed
{
public:
explicit Class1(Platform::String^ foo); // does the 'explicit' keyword here have any value?
private:
Platform::String^ m_foo;
};
Class1::Class1(Platform::String^ foo)
: m_foo(foo)
{
}
}
【问题讨论】: