class Animal
{
public:
int a;
double d;
int f(){ return 25;}
};
Suppose for the code above, I try to initialize an object, by saying new Animal()
, does this new()
also allocate memory for the function f()
?
In other words, what is the difference in memory allocation terms if I had this class instead and did a new Animal()
? :
class Animal
{
public:
int a;
double d;
};