473,326 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Abstract Class & Interface Class

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
3 15541
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Bob Rock | last post by:
Hello, I'd like to be able to allow instanciation of a class (class Class_A) only from another class method (class Class_B). And I'd like to write the necessary code to enforce this behavior...
1
by: Manuel Maria Diaz Gomez | last post by:
Hi Everybody I would like to implement an interface class (abstract), where the pure virtual method can take any parameter, and leave the actual implementation to the end user. I believe this...
9
by: phl | last post by:
hi, I am kind of confused aobut interfaces and abstract classes. In short as I understand it, an interface is like a contract between the class and the interface, so that certain funtions must...
10
by: Brett | last post by:
I'm still trying to figure out concrete reasons to use one over the other. I understand the abstract class can have implementation in its methods and derived classes can only inherit one abstract...
10
by: Joe | last post by:
My question is more an OOD question. I know *how* to implement both abstract classes and interfaces. Here's my question - under what circumstacnes does one use an abstract class and under what...
2
by: RitualDave | last post by:
I get a C2811 error when I compile the following (with the /clr switch): template <class T> ref class Base {}; template <template <class> class TBase> ref class Derived : TBase<int> {};
7
by: gordon | last post by:
Hi I am working through some course notes for a msdn training course in C# and I am a little stuck with the differences between an abstract class and an interface. Could someone please give...
2
by: pradeepbr2003 | last post by:
what is the real time difference between abstract class & interface
5
by: ewpatton | last post by:
I'm working on a modular application that handles working with different file types. Each file type is defined in a separate DLL so that new types can be defined and then imported. Here's the code...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.