Deneme amacıyla şu bildik öğrenci sınıfını :) d ile yazmaya çalışıyordum.
#include <string>
using std::string;
class Ogrenci
{
public:
Ogrenci (string const & ad, short numara)
:
ad_ (ad),
numara_ (numara)
{}
/* .. */
private:
string ad_;
short numara_;
};
int main ()
{}
d versiyonu da bu şekilde:
import std.string;
class Öğrenci
{
string ad_;
short numara_;
public:
this (string const & ad, short numara)
: ad_ (ad), numara_ (numara)
{}
}
void main ()
{}
ama derlerken bir sürü hata alıyorum:
Alıntı:
>dmd ogrenci.d
ogrenci.d(10): found 'const' when expecting ')'
ogrenci.d(10): semicolon expected following function declaration
ogrenci.d(10): Declaration expected, not '&'
ogrenci.d(20): } expected following member declarations in aggregate
D dilinde const (değişmez) referans kullanmamıza gerek var mı? string const & ad gibi .. Bir de D dilinde sınıf bildiriminden hemen sonra ; kullanmaya artık gerek yok mu?
class BirŞeyler {} ; <-- burdaki noktalı virgül
gibi. Teşekkürler..
erdem
--
[ Bu gönderi, http://ddili.org/forum'dan dönüştürülmüştür. ]