+ 2

Is there any universal datatype to declare variable with all types of value????

14th Aug 2018, 10:22 AM
Ashish Kumar Sahoo
Ashish Kumar Sahoo - avatar
3 Respostas
+ 1
For C++ generic programming, look up C++ template classes and C++ function templates. Here is an example function template (although not a great example): https://code.sololearn.com/c4kXn2o734b6/?ref=app
9th Sep 2018, 2:44 PM
Rob Blans
Rob Blans - avatar
0
Java 10 has var, but not really anything besides that.
14th Aug 2018, 10:25 AM
BlazingMagpie
BlazingMagpie - avatar
0
Ashish Kumar Sahoo look up generic classes. the T type is a reference for any type as long as it can be inferred within your class, but look it up to fully understand how it works, this is only for java. class Anytype<T>{ private T anyDataType; public Anytpe(T data){ anyDataType = data } }
14th Aug 2018, 1:15 PM
StealthyTaco
StealthyTaco - avatar