www.digitalmars.com         C & C++   DMDScript  

D - class interface declaration style

reply Mark T <Mark_member pathlink.com> writes:
D is suffering from colonitis
I would prefer "wordy" class and interface declarations syntax like Java 
I like declarations that are easier to read at first glance 
Of course this has a snowball's chance in hell of changing
========================================
D syntax style 

interface IControl
{
void Paint();
}

interface ITextBox : IControl
{
void SetText(string text);
}

class TextBox : ITextBox, IControl
{
..
} .

class MyBaseC   // no explicit abstract class in D
{  
public: 
void MyMethod();   // Abstract method
}

class MyDerivedC : MyBaseC
{
..
}

=================================
Java syntax style

public interface IControl
{
void Paint();
}

public interface ITextBox implements IControl
{
void SetText(string text);
}

class TextBox implements ITextBox, IControl
{
..
}

public abstract class MyBaseC   // Abstract class
{  
public abstract void MyMethod();   // Abstract method
}

public class MyDerivedC extends MyBaseC
{
..
}

=========================================
C# syntax style

interface IControl
{
void Paint();
}

interface ITextBox : IControl
{
void SetText(string text);
}

class TextBox : ITextBox  // TextBox implements both IControl and ITextBox
{
..
} .

abstract class MyBaseC   // Abstract class
{  
public abstract void MyMethod();   // Abstract method
}

class MyDerivedC : MyBaseC
{
..
}
Dec 31 2003
parent "Matthew" <matthew.hat stlsoft.dot.org> writes:
"Mark T" <Mark_member pathlink.com> wrote in message
news:bsvnp6$2i1o$1 digitaldaemon.com...
 D is suffering from colonitis
 I would prefer "wordy" class and interface declarations syntax like Java
 I like declarations that are easier to read at first glance
 Of course this has a snowball's chance in hell of changing

Asked and answered. :::)
Dec 31 2003