Many a times, I have seen in C++ code pointers allocations for structs as;
struct Current{
int amp;
};
Current *cur = new Current();
However, "Current" is a structure and not class here, but is supported in C++. How good is this to be used in place of C-type allocation, as below:
Current *cur = (Current*) malloc (sizeof(Current));
What is the underlying concept behind this? One known to me is, that the "structs" are considered as "classes" in C++.
Concept of struct-VS-class in C++ is known. Query is majorly about the specific use case, as both are permissible, but which should be preferred over, and why?