www.digitalmars.com         C & C++   DMDScript  

c++ - Virtual Functions, Classes and friend functions

reply "Pramod Subramanyan" <pramod_sx rediffmail.com> writes:
How do you tell the compiler that a function is purely virtual and will be
declared only in a sub-class ? i.e, There is not implementation for the
function in the current class.

Can you explicitly declare a virtual class in C++ ? [Like the abstract class
keyword in Java]

Are friends of base classes not friends of sub-classes ?
Apr 22 2001
next sibling parent Jan Knepper <jan smartsoft.cc> writes:
Pramod Subramanyan wrote:

 How do you tell the compiler that a function is purely virtual and will be
 declared only in a sub-class ? i.e, There is not implementation for the
 function in the current class.

class VirtualBase { public : virtual int PureVirtual () = 0; };
 Can you explicitly declare a virtual class in C++ ? [Like the abstract class
 keyword in Java]

There is all kinds of possibilities in C++. However, I do not know Java well enough to answer these questions. Jan
Apr 22 2001
prev sibling parent Roland <rv ronetech.com> writes:
class  ACLASS {
public:
    virtual int virtual_member()=0;
};

With i don't know witch version of SC or DM C++ sometime i had to create the
function on the .CPP:

    int ACLASS::virtual_member() {
    }

Roland


Pramod Subramanyan a écrit :

 How do you tell the compiler that a function is purely virtual and will be
 declared only in a sub-class ? i.e, There is not implementation for the
 function in the current class.

 Can you explicitly declare a virtual class in C++ ? [Like the abstract class
 keyword in Java]

 Are friends of base classes not friends of sub-classes ?

May 02 2001