I like the concept of interface, It enforces its successors to
implement some necessary methods.
Please take a look at the following example:
device.d
-
interface device
{
// I want the three methods implemented by its successors
void PowerOn();
void Powe
Am 07.08.2013 09:11, schrieb SteveGuo:
I like the concept of interface, It enforces its successors to
implement some necessary methods.
Please take a look at the following example:
device.d
-
interface device
{
// I want the three methods implemented by its succe
On Wednesday, 7 August 2013 at 07:11:58 UTC, SteveGuo wrote:
I like the concept of interface, It enforces its successors to
implement some necessary methods.
Please take a look at the following example:
device.d
-
interface device
{
// I want the three methods i
if D would allow this - what is then the difference between a
class with your methods as virtuals + your string?
interface are for loosier coupling then classes - thats why
only declerations not implementations (like your string) are
allowed, same goes to Java and C# (and i think most other
i
On Wednesday, 7 August 2013 at 07:30:52 UTC, SteveGuo wrote:
if D would allow this - what is then the difference between a
class with your methods as virtuals + your string?
interface are for loosier coupling then classes - thats why
only declerations not implementations (like your string) are
what? O_o
let me explain, abstract class requires its successors to
implement all methods, but may have fields.
class successors *always* do something, either their methods
has derived behavior or overridden ones. so does interface, if
you has class derived from interface then its successors ma
On Wednesday, 7 August 2013 at 08:18:43 UTC, SteveGuo wrote:
what? O_o
let me explain, abstract class requires its successors to
implement all methods, but may have fields.
class successors *always* do something, either their methods
has derived behavior or overridden ones. so does interface, i
As mentioned by evilrat earlier the 'string signature' should
probably be made a readonly property, set in the constructor. I
don't think D supports defining a constructor signature on
interfaces (I could be wrong), so you want to define an
invariant as part of the contract.
You may also wan
On Wednesday, 7 August 2013 at 07:11:58 UTC, SteveGuo wrote:
I like the concept of interface, It enforces its successors to
implement some necessary methods.
Please take a look at the following example:
device.d
-
interface device
{
// I want the three methods i