By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,804 Members | 1,666 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,804 IT Pros & Developers. It's quick & easy.

Abstract Class & Interface Class

P: n/a
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.

Feb 21 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Salman wrote:
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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Feb 21 '07 #2

P: n/a
Salman <sa********@gmail.comwrote:
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-lit....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.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Feb 21 '07 #3

P: n/a
Salman wrote:
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?
Feb 21 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.