Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Device Context : Slow Drawing Pin
Erik Funkenbusch13-Sep-00 11:52
Erik Funkenbusch13-Sep-00 11:52 
GeneralResizeToFit when starting minimized Pin
Mike Eriksson12-Sep-00 5:05
Mike Eriksson12-Sep-00 5:05 
GeneralRe: ResizeToFit when starting minimized Pin
Mustafa Demirhan14-Sep-00 23:08
Mustafa Demirhan14-Sep-00 23:08 
GeneralRe: ResizeToFit when starting minimized Pin
Mike Eriksson15-Sep-00 13:45
Mike Eriksson15-Sep-00 13:45 
GeneralSDK: use Dialog as Main Window Pin
Chris Rupp12-Sep-00 1:30
Chris Rupp12-Sep-00 1:30 
GeneralRe: SDK: use Dialog as Main Window Pin
Sam Hobbs12-Sep-00 4:19
Sam Hobbs12-Sep-00 4:19 
GeneralRe: SDK: use Dialog as Main Window Pin
Chris Rupp12-Sep-00 5:36
Chris Rupp12-Sep-00 5:36 
GeneralRTTI Question: testing for inheritance Pin
Jonathan Gilligan11-Sep-00 19:04
Jonathan Gilligan11-Sep-00 19:04 
Here is the short version: I have several classes, some templatized, that inherit from a common abstract base class. I want a way to check at run-time whether a pointer points to an object that inherits from the base class. Because I am using templates, I can't use the MFC IsKindOf().

I have several templatized classes that derive from an abstract base class, following the GoF Bridge pattern:
<br />
class AbstractDataItem<br />
{<br />
public:<br />
  virtual ~AbstractDataItem() = 0; // force abstract class<br />
};<br />
<br />
template<class Ty_> class ConcreteDataItem :<br />
  public AbstractDataItem<br />
{<br />
public:<br />
  virtual ~ConcreteDataItem();<br />
}<br />
<br />
class SpectrogramDataItem :<br />
  public AbstractDataItem<br />
{<br />
public:<br />
  virtual ~SpectrogramDataItem();<br />
}<br />


This summarizes the inheritance structure. Now I have a pointer and I want to check whether it points to something that inherits from AbstractDataItem. Because I am using templates, I cannot have AbstractDataItem inherit from CObject and use DECLARE_DYNAMIC/IMPLEMENT_DYNAMIC and use MFC's IsKindOf().

The standard C++ typeid() function seems only to give me the top-level class and does not provide a way to check forinheritance. I could try dynamic_cast<> and catch exceptions, but there is an awful lot of overhead in that and it's ugly.

I could exhaustively check the typeid against a list of derived classes, but that would kill my ability to subclass existing classes in the hierarchy---I'd have to go back in and rewrite my inheritance-testing list.

It would be nice if I didn't have to completely rewrite my own version of MFC's CObject and CRuntimeClass to handle templates and namespaces.
GeneralRe: RTTI Question: testing for inheritance Pin
Erik Funkenbusch13-Sep-00 11:57
Erik Funkenbusch13-Sep-00 11:57 
QuestionHow to use ADO to connect to the database and retrieve the database . Pin
Kalyan Tej M11-Sep-00 18:14
sussKalyan Tej M11-Sep-00 18:14 
AnswerRe: How to use ADO to connect to the database and retrieve the database . Pin
Mike Eriksson12-Sep-00 3:14
Mike Eriksson12-Sep-00 3:14 
Generalcomctl32 Error Pin
Daniel Barcelos11-Sep-00 17:16
sussDaniel Barcelos11-Sep-00 17:16 
GeneralRe: comctl32 Error Pin
Michael Dunn12-Sep-00 8:52
sitebuilderMichael Dunn12-Sep-00 8:52 
GeneralTrying to find VB equivalent controls Pin
Sean Capstick11-Sep-00 16:51
Sean Capstick11-Sep-00 16:51 
GeneralSubclassing Pin
Jamie Nordmeyer11-Sep-00 9:19
Jamie Nordmeyer11-Sep-00 9:19 
GeneralRe: Subclassing Pin
Nick Hodapp11-Sep-00 11:13
sitebuilderNick Hodapp11-Sep-00 11:13 
GeneralRe: Subclassing Pin
Jamie Nordmeyer11-Sep-00 11:22
Jamie Nordmeyer11-Sep-00 11:22 
GeneralRe: Subclassing Pin
Nick Hodapp11-Sep-00 11:29
sitebuilderNick Hodapp11-Sep-00 11:29 
GeneralRe: Subclassing Pin
Sam Hobbs11-Sep-00 17:34
Sam Hobbs11-Sep-00 17:34 
GeneralRe: Subclassing Pin
Jamie Nordmeyer12-Sep-00 4:54
Jamie Nordmeyer12-Sep-00 4:54 
GeneralRe: Subclassing Pin
Sam Hobbs12-Sep-00 5:38
Sam Hobbs12-Sep-00 5:38 
GeneralToolbar and Dialog Pin
Henrik Pedersen11-Sep-00 4:10
Henrik Pedersen11-Sep-00 4:10 
GeneralCFtpConnection - host type Pin
Alex Chaikin11-Sep-00 4:02
sussAlex Chaikin11-Sep-00 4:02 
GeneralRe: CFtpConnection - host type Pin
Member 120896511-Sep-00 9:47
Member 120896511-Sep-00 9:47 
GeneralRe: CFtpConnection - host type Pin
Member 120896512-Sep-00 4:33
Member 120896512-Sep-00 4:33 

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.