类方法可以是内联还是静态? [英] Can a class method be both inline and static?

查看:128
本文介绍了类方法可以是内联还是静态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有意义?

推荐答案

static 该方法不与类的实例相关联。 (即它没有this指针)。

static means that the method isn't associated with an instance of a class. (i.e. it has no "this" pointer).

inline 是一个编译器提示,应该包括在它被调用的inline中,而不是通过正常分支调用。 (请注意,许多编译器忽略此关键字,并使用自己的指标来决定是否内联)。

inline is a compiler hint that the code for the method ought to be included inline where it is called, instead of being called via a normal branch. (Be aware that many compilers ignore this keyword, and use their own metrics to decide whether to inline).

这些是正交的(不相关的)概念,因此没有特殊的原因它们不能组合。

These are orthogonal (unrelated) concepts, so there's no particular reason they couldn't be combined.

这篇关于类方法可以是内联还是静态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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