Quantcast
Channel: When should I use typedef in C++? - Stack Overflow
Viewing all articles
Browse latest Browse all 14

Answer by sneha for When should I use typedef in C++?

$
0
0

Typedef allows flexibility in your class. When you want to change the data type in the program, you do not need to change multiple locations but just need to change one occurrence.

typedef <datatype example  int or double> value_type

you can give nay name instead of value_type, but value_type is normally the standard name.

So u can use typedef like

value_type i=0;     //same as a int or double i=0; 

Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>