?????????????
????C++ ????
?????????????????????????渭????????????????????????????????????????????????

struct A
{
int operator <  (int i);
int operator <= (int i);
int operator >  (int i);
int operator >= (int i);
};
int operator <  (int i?? A &a) { return a >  i; }
int operator <= (int i?? A &a) { return a >= i; }
int operator >  (int i?? A &a) { return a <  i; }
int operator >= (int i?? A &a) { return a <= i; }
???????械? 8 ???????????伞?
????D ????
????D ?????????????????????????????????????????????????????????
????struct A
????{
????int opCmp(int i);
????}
?????????????? opCmp ??????????? <??<=??> ?? >= ?????????????????????????????????????
?????????????????????????????????????????????????? D ?械??????????????? C++ ??????????????????????????????????????????效????
?????????? using ????
????C++ ????
????C++ ?械? using ???? ??????????????????????????????????????
????namespace Foo
????{
????int x;
????}
????using Foo::x;
????D ????
????D ?????????????????? #include ???????????????????? using ??????
????---- Module Foo.d ------
????module Foo;
????int x;
????---- Another module ----
????import Foo;
????alias Foo.x x;
????????????? using ?????????????????????????????????????????????????????????
????RAII???????眉????????
????C++ ????
?????? C++ ?校??????????????????????????????????????????????????????????????RAII ??????????????????????????????????
????class File
????{   Handle *h;
????~File()
????{
????h->release();
????}
????};
????D ????
???????????????????????????????????妾�?? D ??????????????????????????????????????????????????????????????? D ?锌??? synchronized ?????????????????
???????????????????? auto ?????Auto ????????????????????????????????????
auto class File
{   Handle h;
~this()
{
h.release();
}
}
void test()
{
if (...)
{   auto File f = new File();
...
// f.~this() ????????????????校???????????????????????????????
}

????????
????C++ ????
??????????????????????????????????? get ?? set ??????

 

class Abc
{
public:
void setProperty(int newproperty) { property = newproperty; }
int getProperty() { return property; }
private:
int property;
};
Abc a;
a.setProperty(3);
int x = a.getProperty();

??????????些????????????????????????????????????????貌??????????????谐????? getProperty() ?? setProperty() ???谩?

???????????????????????婕�???????????????????SPASVO小??(021-61079698-8054)?????????????????????????