www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/28/08:20:32

From: Andrej Aderhold <im-a AT earthling DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: can't get abstract virtual function to work
Date: Sun, 28 Mar 1999 14:39:45 +0200
Organization: Online-Kiosk GmbH & Alphacom GmbH
Message-ID: <36FE2311.287E8DF4@earthling.net>
NNTP-Posting-Host: b247.spektracom.de
Mime-Version: 1.0
X-Server-Date: 28 Mar 1999 13:47:57 GMT
X-Mailer: Mozilla 4.04 [en] (Win95; I)
Lines: 34
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

hallo Everyone,
following example produces a Compile time error in DJGPP:
The Compiler complains about the definit. of the pure virtual function
fn1 in class C0 as following:

ERROR: Cannot allocate an Object of type 'C0'
ERROR: since the following virtual functions are abstract:
ERROR: void C0::fn1()

//-----------------------
class C0
{
   public:
        virtual void fn1(void) = 0;
};

class C1
{
    public:
      virtual void fn1(){return 1}
}

main()
{
   C0 *c0 = new C1;
   c0->fn1();
}

Why does DJGPP dont like my Class to have a abstract virtual function ?
Thanks for any help

Andrej Aderhold
Bayreuth, Germany

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019