Consider the following code:
#include <iostream>
using namespace std;
class item{
int cost;
float price;
public:
void getData(){
cin>>cost;
cin>>price;
}
};
int main(){
cout << sizeof(item);
return 0;
}
The output of this code is 8 bytes, as far as I understand it is 4 bytes for int and 4 bytes for float. Why does the sizeof operator not print the size of function, also how much and where is the memory allocated for function getData?