home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,854 of 2,753   
   BGB / cr88192 to Harold Aptroot   
   Re: How to implement dynamic typing?   
   11 Apr 10 23:51:31   
   
   From: cr88192@hotmail.com   
      
   "Harold Aptroot"  wrote in message   
   > "BGB / cr88192"  wrote in message   
      
      
   >> C++: if(dynamic_cast(obj)) ...   
   >> Java: if(obj instanceof Foo) ...   
   >> C#: if(typeof(Foo).IsInstanceOf(obj)) ...   
   >   
   > How about: if (obj is Foo) for C#?   
      
   I didn't know about this when I wrote this message...   
   but, yes, this is a better notation...   
      
   I am not exactly well experienced in C#, FWIW.   
      
      
   actually, at first I didn't even know this, so I was left using casts and   
   catching the exception, but figured there had to be a better way than this   
   (I didn't believe MS would botch up this bad). after a lot of fiddling, I   
   figured out the "typeof" notation, and it worked.   
      
   "is" seems better though.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca