功能范围是什么意思? [英] What does scope of functions mean?

查看:74
本文介绍了功能范围是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

功能范围是什么意思?

我了解变量的范围.当我们谈论函数的范围时,它是指结构(类)中的函数还是我们在 C/C++ 程序的 main() 中调用的普通函数的范围?

I understand the scope of variables. When we talk about the scope of functions, is it referred to the functions within structures (classes) or is there scope for the normal functions that we call in main() of a C/C++ program?

推荐答案

函数可以具有全局、命名空间、类(在这种情况下通常称为成员)或局部(在另一个函数中)作用域.它们也可以是 static 给它们内部链接或匿名命名空间,使它们无法在翻译单元外部访问(同时仍然具有外部链接,因此它们可以用作模板参数).

Functions can have global, namespace, class (usually called members in that case), or local (within another function) scope. They can also be static giving them internal linkage or within an anonymous namespace, making them inaccessible outside a translation unit (while still having external linkage so they can be used as template parameters).

这篇关于功能范围是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆