Click here to Skip to main content
15,889,335 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: pure virtual functions Pin
hrishiS17-Sep-09 20:46
hrishiS17-Sep-09 20:46 
GeneralRe: pure virtual functions Pin
Stuart Dootson17-Sep-09 20:58
professionalStuart Dootson17-Sep-09 20:58 
GeneralRe: pure virtual functions Pin
hrishiS17-Sep-09 21:23
hrishiS17-Sep-09 21:23 
GeneralRe: pure virtual functions Pin
Stuart Dootson17-Sep-09 21:50
professionalStuart Dootson17-Sep-09 21:50 
GeneralRe: pure virtual functions Pin
hrishiS17-Sep-09 21:33
hrishiS17-Sep-09 21:33 
GeneralRe: pure virtual functions Pin
Stuart Dootson17-Sep-09 21:45
professionalStuart Dootson17-Sep-09 21:45 
GeneralRe: pure virtual functions Pin
hrishiS17-Sep-09 22:25
hrishiS17-Sep-09 22:25 
GeneralRe: pure virtual functions Pin
Cedric Moonen17-Sep-09 21:00
Cedric Moonen17-Sep-09 21:00 
hrishiS wrote:
But there is always a small difference between the abstract class and interface.


An interface is a concept that is taken from other programing languages that natively supports interfaces: an interface simply describes the public method of an object, but doesn't have any functionality. This object should then be implemented by a class which inherits from the interface.
So, it means that the interface only contains pure virtual functions (and no data member).

An abstract class on the other hand is a class that cannot be instanciated directly, so you need to inherit from it. To make a class abstract, it needs to contain at least one pure virtual function (but it can contain other functions and also data members).


hrishiS wrote:
Anyway, when we talk about interface also, when do we need/use them exactly?Could you please give me a practical example.


If you really want to implement the concept of an interface, then you need to use pure virtual functions for every function of the interface, because the interface cannot contain any funcitonality. All the functions from the interface are pure virtual functions.

Cédric Moonen
Software developer

Charting control [v2.0]
OpenGL game tutorial in C++

AnswerRe: pure virtual functions Pin
Kushagra Tiwari17-Sep-09 20:44
Kushagra Tiwari17-Sep-09 20:44 
GeneralRe: pure virtual functions Pin
Cedric Moonen17-Sep-09 20:53
Cedric Moonen17-Sep-09 20:53 
GeneralRe: pure virtual functions Pin
hrishiS17-Sep-09 20:55
hrishiS17-Sep-09 20:55 
AnswerRe: pure virtual functions Pin
«_Superman_»17-Sep-09 20:44
professional«_Superman_»17-Sep-09 20:44 
AnswerRe: pure virtual functions Pin
Cedric Moonen17-Sep-09 20:51
Cedric Moonen17-Sep-09 20:51 
GeneralRe: pure virtual functions Pin
hrishiS17-Sep-09 21:00
hrishiS17-Sep-09 21:00 
GeneralRe: pure virtual functions Pin
Cedric Moonen17-Sep-09 21:12
Cedric Moonen17-Sep-09 21:12 
GeneralRe: pure virtual functions Pin
CPallini17-Sep-09 22:09
mveCPallini17-Sep-09 22:09 
AnswerRe: pure virtual functions Pin
RugbyLeague17-Sep-09 22:09
RugbyLeague17-Sep-09 22:09 
GeneralRe: pure virtual functions Pin
hrishiS17-Sep-09 22:28
hrishiS17-Sep-09 22:28 
GeneralRe: pure virtual functions Pin
RugbyLeague17-Sep-09 22:43
RugbyLeague17-Sep-09 22:43 
AnswerRe: pure virtual functions - an example for you. Pin
Iain Clarke, Warrior Programmer17-Sep-09 23:00
Iain Clarke, Warrior Programmer17-Sep-09 23:00 
QuestionDifferentiating SHUTDOWN and RESTART ? Pin
Kushagra Tiwari17-Sep-09 20:29
Kushagra Tiwari17-Sep-09 20:29 
AnswerRe: Differentiating SHUTDOWN and RESTART ? Pin
«_Superman_»17-Sep-09 20:42
professional«_Superman_»17-Sep-09 20:42 
GeneralRe: Differentiating SHUTDOWN and RESTART ? Pin
Kushagra Tiwari17-Sep-09 20:46
Kushagra Tiwari17-Sep-09 20:46 
QuestionRe: Differentiating SHUTDOWN and RESTART ? Pin
Kushagra Tiwari17-Sep-09 22:25
Kushagra Tiwari17-Sep-09 22:25 
GeneralRe: Differentiating SHUTDOWN and RESTART ? Pin
David Crow18-Sep-09 6:26
David Crow18-Sep-09 6:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.