C++ member function translations

Bill Baxter dnewsgroup at billbaxter.com
Thu Jul 26 23:34:45 PDT 2007


Can someone who's figured this out tell me what the translations for the 
following C++ member function signatures would be in D 2.0?

C++:
const Foo& func(const Bar&) const;
const Foo& func(Bar&) const;
const Foo& func(const Bar&);
const Foo& func(Bar&);
       Foo& func(Bar&) const;
       Foo& func(Bar&);

And for D I'm interested in both the struct and the class case for Foo.
Let Bar be a D struct in all cases.
I'm after similar semantics so Foo& as a D class is going to be just 
Foo, and as a D struct I presume it should be 'ref Foo'.

C++:      const Foo& func(const Bar&) const;
D class:
D struct:

C++:      const Foo& func(Bar&) const;
D class:
D struct:

C++:      const Foo& func(const Bar&);
D class:
D struct:

C++:      const Foo& func(Bar&);
D class:
D struct:

C++:      Foo& func(Bar&) const;
D class:
D struct:

C++:      Foo& func(Bar&);
D class:
D struct:


More information about the Digitalmars-d-learn mailing list