Forward Declaration

Satish firehead.satish at gmail.com
Thu Mar 15 20:37:07 PDT 2007


Hello D Programmers

As a C++ programmer I have written classes such as

class Object{
  public:
    Object(int value1);
};

Object::Object(int value1){}

My terminology will be wrong here but I really enjoy separating the
declaration and implementation of class members.


Yes in C++ also allows such declaration:
class Object{
  public:
    Object(int value1){return 100;}
    long server(){
     //several lines of code 1
     //several lines of code 2
     //several lines of code 3
     //several lines of code 4
    }
};


Why doesn't 'D' allow to separate method definition and method implementation
such as
<
     Object::Object(int value1){
        //my implementation
     }
>


If becomes tough not hard to debug classes if/when there is closing curly
bracket if it missing.


I seem to more time ensure that I don't miss any opening and closing braces.


Thanks for the advice.

Satish



More information about the Digitalmars-d mailing list