Click here to Skip to main content
15,897,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Using Abstract classes [modified] Pin
Cedric Moonen2-Oct-07 4:37
Cedric Moonen2-Oct-07 4:37 
GeneralRe: Using Abstract classes Pin
Apstolo2-Oct-07 5:47
Apstolo2-Oct-07 5:47 
QuestionDebug break on 64 bit Vista in VC6 hangs debugged app Pin
Paul Vickery2-Oct-07 3:01
professionalPaul Vickery2-Oct-07 3:01 
QuestionMFC property sheet, change tab event Pin
Caliban61001-Oct-07 23:41
Caliban61001-Oct-07 23:41 
AnswerRe: MFC property sheet, change tab event Pin
Nishad S2-Oct-07 0:47
Nishad S2-Oct-07 0:47 
QuestionBoost Test question urgent Pin
monsieur_jj1-Oct-07 22:25
monsieur_jj1-Oct-07 22:25 
QuestionWhat is theUse Of Abstract class Pin
tasumisra1-Oct-07 22:06
tasumisra1-Oct-07 22:06 
AnswerRe: What is theUse Of Abstract class Pin
Cedric Moonen1-Oct-07 22:38
Cedric Moonen1-Oct-07 22:38 
tasumisra wrote:
Can anybody tell me what is the use of abstract class
since we cant instantiale the abstract class... so why we are using it...


Abstract classes are used when you want to provide a common base class to several objects but you don't want to be able to instantiate it directly. Maybe a little example will make things clear.

Suppose you are writing an asteroid game in which you can have several 'entities': the player plane, the asteroids and the missiles shooted by the player ship. Obviously, they all have some common 'functionalities' (they need to be drawn on the screen, you can move them, they can be destroyed, ...), so it make sense to inherit from a common base class, the CEntity class (for example). Of course, you don't want to be able to instantiate a CEntity directly so, you will make it an abstract class. For example how to draw the different entities on the screen depends on the entity itself, so you can make this function a pure virtual function (meaning that the child classes MUST implement this method, which is logical).

Hope this makes a little bit more sense.



Cédric Moonen
Software developer

Charting control [v1.2]

AnswerRe: What is theUse Of Abstract class Pin
Nemanja Trifunovic2-Oct-07 3:49
Nemanja Trifunovic2-Oct-07 3:49 
AnswerRe: What is theUse Of Abstract class Pin
Leslie Sanford2-Oct-07 6:35
Leslie Sanford2-Oct-07 6:35 
Questionthemes & controls Pin
mitok1-Oct-07 21:54
mitok1-Oct-07 21:54 
QuestionFunction Pointer error Pin
Mustafa Ismail Mustafa1-Oct-07 20:59
Mustafa Ismail Mustafa1-Oct-07 20:59 
AnswerRe: Function Pointer error Pin
Cedric Moonen1-Oct-07 21:09
Cedric Moonen1-Oct-07 21:09 
GeneralRe: Function Pointer error Pin
Mustafa Ismail Mustafa1-Oct-07 21:20
Mustafa Ismail Mustafa1-Oct-07 21:20 
GeneralRe: Function Pointer error Pin
Cedric Moonen1-Oct-07 21:26
Cedric Moonen1-Oct-07 21:26 
GeneralRe: Function Pointer error Pin
Mustafa Ismail Mustafa1-Oct-07 21:21
Mustafa Ismail Mustafa1-Oct-07 21:21 
GeneralRe: Function Pointer error Pin
Cedric Moonen1-Oct-07 21:28
Cedric Moonen1-Oct-07 21:28 
GeneralRe: Function Pointer error Pin
Mustafa Ismail Mustafa1-Oct-07 21:38
Mustafa Ismail Mustafa1-Oct-07 21:38 
QuestionA Basic File Question. Pin
chandu0041-Oct-07 19:58
chandu0041-Oct-07 19:58 
AnswerRe: A Basic File Question. Pin
Nishad S1-Oct-07 20:43
Nishad S1-Oct-07 20:43 
GeneralRe: A Basic File Question. Pin
chandu0041-Oct-07 21:02
chandu0041-Oct-07 21:02 
AnswerRe: A Basic File Question. Pin
KarstenK1-Oct-07 21:17
mveKarstenK1-Oct-07 21:17 
AnswerRe: A Basic File Question. Pin
Nelek1-Oct-07 21:50
protectorNelek1-Oct-07 21:50 
QuestionError Message Pin
ashishbhatt1-Oct-07 17:50
ashishbhatt1-Oct-07 17:50 
AnswerRe: Error Message Pin
zakkas24831-Oct-07 18:06
zakkas24831-Oct-07 18:06 

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.