Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#Actualnoatom

Posted 01 May 2013 - 01:45 PM

with static_cast

 

You can explicitly convert a pointer of a type A to a pointer of a type B if A is a base class of B. If A is not a base class of B, a compiler error will result.

You may cast an lvalue of a type A to a type B& if the following are true:

  • A is a base class of B
  • You are able to convert a pointer of type A to a pointer of type B
  • The type B has the same or greater const or volatile qualifiers than type A
  • A is not a virtual base class of B

The result is an lvalue of type B.

A pointer to member type can be explicitly converted into a different pointer to member type if both types are pointers to members of the same class. This form of explicit conversion may also take place if the pointer to member types are from separate classes, however one of the class types must be derived from the other.

 

 

As if my head wasn't spinning...


#1noatom

Posted 01 May 2013 - 01:45 PM

You can explicitly convert a pointer of a type A to a pointer of a type B if A is a base class of B. If A is not a base class of B, a compiler error will result.

You may cast an lvalue of a type A to a type B& if the following are true:

  • A is a base class of B
  • You are able to convert a pointer of type A to a pointer of type B
  • The type B has the same or greater const or volatile qualifiers than type A
  • A is not a virtual base class of B

The result is an lvalue of type B.

A pointer to member type can be explicitly converted into a different pointer to member type if both types are pointers to members of the same class. This form of explicit conversion may also take place if the pointer to member types are from separate classes, however one of the class types must be derived from the other.

 

 

As if my head wasn't spinning...


PARTNERS