Click here to Skip to main content
16,011,947 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Plz..Help needed in resolving :error LNK2001 Pin
Kiran Satish28-Sep-04 19:27
Kiran Satish28-Sep-04 19:27 
QuestionHow to disable this button when process is running Pin
JingleLee26-Sep-04 16:44
JingleLee26-Sep-04 16:44 
AnswerRe: How to disable this button when process is running Pin
Sujan Christo26-Sep-04 18:15
Sujan Christo26-Sep-04 18:15 
GeneralRe: How to disable this button when process is running Pin
Anonymous26-Sep-04 19:36
Anonymous26-Sep-04 19:36 
GeneralRe: How to disable this button when process is running Pin
Sujan Christo26-Sep-04 21:26
Sujan Christo26-Sep-04 21:26 
GeneralUSB Pin
Jill Peterson26-Sep-04 16:40
Jill Peterson26-Sep-04 16:40 
Generalvector of polymorph objects Pin
yahp26-Sep-04 13:05
yahp26-Sep-04 13:05 
GeneralRe: vector of polymorph objects Pin
Andrew Walker26-Sep-04 14:26
Andrew Walker26-Sep-04 14:26 
yahp wrote:
Is there a conveniant workaround?

Not really.

This is a general design issue which isn't generally a hassle to get around, but it depends on the size of the inheritance heirarchy. It's generally caused by the abstract base class not being truly representative of the contract that the subclasses should fulfill.

1. Change the abstract base class. Changes should allow any operations of the subclasses to be called through the base class. Although this is a hassle it promotes the best design and IMHO provides the best support for maintainability

2. Store pointers to the base class and the objects themselves in separate collections. This works well if the problem is fairly small - but it gets ugly because you need to keep many collections in sync (problematic for objects on the stack).

3. Use a type field. Supposedly an OO No-No - keep track of which type the object is inside a value within each object. You can then cast to the appropriate object. Probably not a good idea unless you know that this part of your design won't get much larger.

4. Use a dynamic_cast. Similar idea to 3, but the compiler keeps track of the information for you. If the dynamic_cast fails you get a null pointer back.



If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts your aim;
Yours is the Earth and everything that's in it.

Rudyard Kipling

GeneralRe: vector of polymorph objects Pin
yahp27-Sep-04 6:30
yahp27-Sep-04 6:30 
GeneralRe: vector of polymorph objects Pin
Andrew Walker29-Sep-04 2:15
Andrew Walker29-Sep-04 2:15 
GeneralRe: vector of polymorph objects Pin
yahp29-Sep-04 7:21
yahp29-Sep-04 7:21 
Generalc++ dll that connects and fetch data from ODBC Conn Pin
Member 13518826-Sep-04 10:10
Member 13518826-Sep-04 10:10 
Questionsource code to draw x and y cordinates? Pin
babur khan26-Sep-04 9:39
babur khan26-Sep-04 9:39 
AnswerRe: source code to draw x and y cordinates? Pin
__Oren__26-Sep-04 12:10
__Oren__26-Sep-04 12:10 
GeneralGetClientRect returns dimensions, need control location Pin
Vaclav26-Sep-04 9:15
Vaclav26-Sep-04 9:15 
GeneralRe: GetClientRect returns dimensions, need control location Pin
Andrzej Markowski26-Sep-04 10:08
Andrzej Markowski26-Sep-04 10:08 
GeneralRe: Update Pin
Vaclav27-Sep-04 7:41
Vaclav27-Sep-04 7:41 
GeneralRe: Update Pin
Andrzej Markowski27-Sep-04 8:25
Andrzej Markowski27-Sep-04 8:25 
GeneralRe: GetClientRect returns dimensions, need control location Pin
Andrzej Markowski28-Sep-04 9:00
Andrzej Markowski28-Sep-04 9:00 
Generalimport a mp3 play funstion Pin
gamitech26-Sep-04 8:53
gamitech26-Sep-04 8:53 
GeneralRe: import a mp3 play funstion Pin
InflatableGarfield26-Sep-04 10:35
InflatableGarfield26-Sep-04 10:35 
GeneralNew to MFC - Messages Pin
__Oren__26-Sep-04 5:15
__Oren__26-Sep-04 5:15 
GeneralRe: New to MFC - Messages Pin
Vaclav26-Sep-04 9:30
Vaclav26-Sep-04 9:30 
GeneralRe: New to MFC - Messages Pin
__Oren__26-Sep-04 12:06
__Oren__26-Sep-04 12:06 
GeneralRe: New to MFC - Messages Pin
Vivi Chellappa26-Sep-04 17:27
professionalVivi Chellappa26-Sep-04 17:27 

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.