Abstract Class & Interface Class

S

Salman

One one please tell me whats the difference between ABSTRACT Class and
INTERFACE Class in c++. If you can explain me using examples, that
would be more good for me.
 
V

Victor Bazarov

Salman said:
One one please tell me whats the difference between ABSTRACT Class and
INTERFACE Class in c++. If you can explain me using examples, that
would be more good for me.

An abstract class contains at least one pure virtual function.
An interface class [usually] doesn't have any data members.

V
 
M

Marcus Kwok

Salman said:
One one please tell me whats the difference between ABSTRACT Class and
INTERFACE Class in c++. If you can explain me using examples, that
would be more good for me.

An abstract class is a class that has at least one pure virtual
function, thus cannot be instantiated directly. The idea is that
derived classes will override the virtual function, allowing multiple
types to be used using a common interface. See:
http://www.parashift.com/c++-faq-lite/abcs.html#faq-22.3

C++ has no notion of an "interface" class; however applying the Java
terminology to C++, an interface class would basically be an abstract
class that is composed entirely of pure virtual functions.
 
R

red floyd

Salman said:
One one please tell me whats the difference between ABSTRACT Class and
INTERFACE Class in c++. If you can explain me using examples, that
would be more good for me.

Have you thought about reading your textbook or asking your instructor?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,235
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top