Top "Casting" questions

Casting is a process where an object type is explicitly converted into another type if the conversion is allowed.

When to use reinterpret_cast?

I am little confused with the applicability of reinterpret_cast vs static_cast. From what I have read the general …

c++ casting reinterpret-cast
convert double to int

What is the best way to convert a double to an int? Should a cast be used?

c# .net casting type-conversion
How to cast Object to its actual type?

If I have: void MyMethod(Object obj) { ... } How can I cast obj to what its actual type is?

c# object types casting typeof
How to convert string to boolean php

How can I convert string to boolean? $string = 'false'; $test_mode_mail = settype($string, 'boolean'); var_dump($test_mode_mail); …

php string casting boolean
What is the difference between up-casting and down-casting with respect to class variable

What is the difference between up-casting and down-casting with respect to class variable? For example in the following program class …

java casting class-variables downcast upcasting
Converting BigDecimal to Integer

I have Hibernate method which returns me a BigDecimal. I have another API method to which I need to pass …

java integer casting bigdecimal
Why don't Java's +=, -=, *=, /= compound assignment operators require casting?

Until today, I thought that for example: i += j; Was just a shortcut for: i = i + j; But if we …

java casting operators variable-assignment assignment-operator
Casting a number to a string in TypeScript

Which is the the best way (if there is one) to cast from number to string in Typescript? var page_…

javascript casting typescript
How to cast int to enum in C++?

How do I cast an int to an enum in C++? For example: enum Test { A, B }; int a = 1; How …

c++ casting enums
Cast Int to enum in Java

What is the correct way to cast an Int to an enum in Java given the following enum? public enum …

java casting enums ordinal