+ 2
Is there any universal datatype to declare variable with all types of value????
3 Respuestas
+ 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
0
Java 10 has var, but not really anything besides that.
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
}
}