digitalmars.D - abstract problem
- Regan Heath (31/31) Jun 23 2004 --[test.d]--
- Arcane Jill (5/8) Jun 24 2004 "private" means CANNOT be inherited. "abstract" means MUST be inherited....
- Sean Kelly (4/11) Jun 24 2004 Really? This is a pretty common construct in C++ as a means to separate
- Regan Heath (7/16) Jun 24 2004 I'll give it a go, I was trying to say that foo must be inherited as a
- Regan Heath (50/68) Jun 25 2004 Ok, it works. But.. this is valid C++
--[test.d]-- class A { public: void bar() { foo(); } private: abstract void foo(); } class B : A { private: void foo() { } } void main() { B b; } D:\D\src\build\temp>dmd test.d d:\D\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved test.obj(test) Error 42: Symbol Undefined _D4test1A3fooFZv --- errorlevel 1 This is supposed to delcare an abstract class A which B is derived from filling in the missing functions. What am I doing wrong? Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 23 2004
In article <opr922soyy5a2sq9 digitalmars.com>, Regan Heath says...What am I doing wrong?This (I think)...private: abstract void foo();"private" means CANNOT be inherited. "abstract" means MUST be inherited. The two don't go together. Try changing "private" to "protected". Arcane Jill
Jun 24 2004
In article <cbdul8$402$1 digitaldaemon.com>, Arcane Jill says...In article <opr922soyy5a2sq9 digitalmars.com>, Regan Heath says...Really? This is a pretty common construct in C++ as a means to separate interface from implementation. I had assumed this was a compiler error. SeanWhat am I doing wrong?This (I think)...private: abstract void foo();"private" means CANNOT be inherited. "abstract" means MUST be inherited. The two don't go together. Try changing "private" to "protected".
Jun 24 2004
On Thu, 24 Jun 2004 07:08:24 +0000 (UTC), Arcane Jill <Arcane_member pathlink.com> wrote:In article <opr922soyy5a2sq9 digitalmars.com>, Regan Heath says...I'll give it a go, I was trying to say that foo must be inherited as a private method. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/What am I doing wrong?This (I think)...private: abstract void foo();"private" means CANNOT be inherited. "abstract" means MUST be inherited. The two don't go together. Try changing "private" to "protected".
Jun 24 2004
On Fri, 25 Jun 2004 09:25:46 +1200, Regan Heath <regan netwin.co.nz> wrote:On Thu, 24 Jun 2004 07:08:24 +0000 (UTC), Arcane Jill <Arcane_member pathlink.com> wrote:Ok, it works. But.. this is valid C++ class A { public: void bar() { foo(); } protected: private: virtual void foo() = 0; }; class B : A { public: protected: private: void foo() { } }; void main() { B *b = new B(); } and the D I wrote, IMO equivalent to the above, and does not work: --[test.d]-- class A { public: void bar() { foo(); } private: abstract void foo(); } class B : A { private: void foo() { } } void main() { B b; } D:\D\src\build\temp>dmd test.d d:\D\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved test.obj(test) Error 42: Symbol Undefined _D4test1A3fooFZv --- errorlevel 1 So I think this is a bug. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/In article <opr922soyy5a2sq9 digitalmars.com>, Regan Heath says...I'll give it a go, I was trying to say that foo must be inherited as a private method. Regan.What am I doing wrong?This (I think)...private: abstract void foo();"private" means CANNOT be inherited. "abstract" means MUST be inherited. The two don't go together. Try changing "private" to "protected".
Jun 25 2004