hi everyone,

        in the following program i m tyring to use dynamic_cast but 
it is showing a run time error, can any one please rectify the 
error , i have used vc++ compiler.

# include <iostream.h>

class swidget;

class widget
{
        //int w;
        public :
                int w;
                widget()
                {
                 w = 0;
                }
                virtual void display(swidget *s)
                {
                        cout<<w;
                }
};

class swidget : public widget
{
        //int sw;
        public :
                int sw;
                swidget()
                {
                 sw = 0;
                }
                void display(swidget *s)
                {
                        cout<<sw;
                }
};

void update(swidget *s)
{
        //cout<<s->w;
        //s->w = 10;
        //cout<<s->sw;

        if(s == NULL)
                cout<<"ksjkjkjdksjdskdj";       
}

void main()
{
        //swidget *s = new swidget;
        widget *w = new widget;
        swidget *s = new swidget;
        update(dynamic_cast<swidget *>(w));
}


thanks,
greycode05.








------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe : [EMAIL PROTECTED]

 
Yahoo! Groups Links

<*> To reply to this message, go to:
    
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=4583
    Please do not reply to this message via email. More information here:
    http://help.yahoo.com/help/us/groups/messages/messages-23.html

<*> To visit your group on the web, go to:  
    http://groups.yahoo.com/group/Programmers-Town/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to