sizeof求函数大小

来源:百度知道 编辑:UC知道 时间:2024/05/31 08:12:27
#include "stdafx.h"
#include <iostream>
#include "Student.h"
using namespace std;

void func(Student &b)
{
b.display();
b.change(101,80.5);
b.display();
}
int main()
{
Student stud(101,78.5);

func(stud);

cout << sizeof(Student) << endl << sizeof(stud) << endl;

return 0;
}

我想知道func 函数的大小 应该怎么写sizeof?

看看文档中的说明吧:不可操作对象
The sizeof operator cannot be used with the following operands:

Functions. (However, sizeof can be applied to pointers to functions.)

Bit fields.

Undefined classes.

The type void.

Dynamically allocated arrays.

External arrays.

Incomplete types.

Parenthesized names of incomplete types