Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

cast cpp


// conversion de int en char 
int i = 100; 
char c = static_cast<char>( i ); 
  
// conversion de float en int 
float f = 100.0f; 
i = static_cast<int>( f ); 
  
// conversion classes dérivée -> classe parent 
class A {}; 
class B : public A {}; 
  
B *b = new B; 
A *a = static_cast<A*>( b );
Source by cpp.developpez.com #
 
PREVIOUS NEXT
Tagged: #cast #cpp
ADD COMMENT
Topic
Name
4+5 =