is operator in vc 
Author Message
 is operator in vc

Hello,
    In C# there is the is operator to check if a given type is compatibale
with another example:

            if (oCustomer is oPerson){

            }

How can i do this in VC.Net ?
Thanks,
Jose.



Mon, 05 Dec 2005 22:39:34 GMT  
 is operator in vc
__gc class Person
{

Quote:
};

__gc class Customer : public Person
{

Quote:
};

template< class T, class O>
Boolean isInstance( O o )
{
    return dynamic_cast< T >(o) != 0;

Quote:
}

...

Customer *oCustomer = new Customer();

...

if ( isInstance<Person*>(oCustomer) )
{
    ....

Quote:
}
>-----Original Message-----
>Hello,
>    In C# there is the is operator to check if a given
type is compatibale
>with another example:

>            if (oCustomer is oPerson){

>            }

>How can i do this in vc.net ?
>Thanks,
>Jose.

>.



Mon, 05 Dec 2005 23:49:29 GMT  
 is operator in vc
Thanks!



Quote:
> __gc class Person
> {
> };

> __gc class Customer : public Person
> {
> };

> template< class T, class O>
> Boolean isInstance( O o )
> {
>     return dynamic_cast< T >(o) != 0;
> }

> ...

> Customer *oCustomer = new Customer();

> ...

> if ( isInstance<Person*>(oCustomer) )
> {
>     ....
> }

> >-----Original Message-----
> >Hello,
> >    In C# there is the is operator to check if a given
> type is compatibale
> >with another example:

> >            if (oCustomer is oPerson){

> >            }

> >How can i do this in vc.net ?
> >Thanks,
> >Jose.

> >.



Tue, 06 Dec 2005 00:35:42 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. I am stuck with VC optimization.

2. I am new to programming and am lost

3. operator new behavior in VC.NET

4. Help:overloading delete operator in vc++ 4.0

5. Inlining operators VC++6.0

6. VC++5.0 compiler can not tell two operator !=

7. overriding operator new[] - (VC 4.2)

8. Help:overloading delete operator in vc++ 4.0

9. Link problem (LNK4006) with VC (operator new,delete)

10. comparision operator ignore type cast operators

11. Math operators is C. Exponent operator?

12. Which is faster relational operator or equality operator?

 

 
Powered by phpBB® Forum Software