X-Originating-IP: [208.160.246.197] From: "Nimrod Abing" To: djgpp AT delorie DOT com Subject: Re: Templates and virtual ? Date: Mon, 11 Sep 2000 15:19:55 PHT Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 11 Sep 2000 07:19:56.0133 (UTC) FILETIME=[AFAC0150:01C01BC0] Reply-To: djgpp AT delorie DOT com >From: "Rafał Maj" >Reply-To: djgpp AT delorie DOT com >To: djgpp AT delorie DOT com >Subject: Templates and virtual ? >Date: Fri, 8 Sep 2000 22:16:19 +0200 > >Hi, >why I cann't use virtual with templates, like this : > >class test { public : > template > virtual void fun(typ var) { } >}; > >thanks, >Rafal > You should have given a more or less complete example here, but anyway: template // <- Use this at the top of a class definition. class test { public: virtual void fun(typ var) { } virtual void gun(typ var); }; template // <- Or at the top of a class method definition. void test::gun(typ var) { //. . . } this creates a generic class called `test' to actually use this template, you will have to _instantiate_ it. test testobject; ... testobject.fun('X'); Read a book on C++ programming about this. C++ the Language ?th Ed, by Bjarne Strourstrup. I forget what edition I used, but check out the latest edition if possible. HTH. ---------------- _nimrod_a_abing_ +----------------------------------------------------+ |Homepage: http://www.geocities.com/n_abing/index.htm| +----------------------------------------------------+ _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.