功能不是一个对象 [英] function is not an object
问题描述
是真是假?
asdf写道:
对错吗?
对象具有状态,身份,生命周期,存储和行为。
那些功能有哪些?你能指出一个功能吗?
-
Phlip
http://www.greencheese.us/ZeekLand < - 不是博客!!!
< blockquote>所以函数不是一个对象。
但我认为我可以通过指向函数的指针指向一个函数。
Phlip写道:
asdf写道:
对不对?
对象具有状态,身份,生命周期,存储和行为。
那些功能有哪些?你能指出一个功能吗?
-
Phlip
http://www.greencheese.us/ZeekLand < - 不是博客!!!
asdf写道:
对不对?
这个问题似乎是关于c ++社区如何定义
" object"概念。
我会说假。这就是原因。
*符号用于解除引用或定义指向
对象的指针。
但是,*符号也用于定义指向函数的指针。
因此,如果函数不是对象,那么什么是类型的东西a
指向函数的指针指向?
我会说指向函数的指针就是
$的一个例子b $ b指向对象的指针,因此函数是一个对象。
Paul Epstein
True or false ?
asdf wrote:
True or false ?Objects have state, identity, lifespan, storage, and behavior. Which of
those do functions have? Can you point to a function?
--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
So function is not an object.
But I think I can point to a function, by the pointer to the function.
Phlip wrote:asdf wrote:
True or false ?
Objects have state, identity, lifespan, storage, and behavior. Which of
those do functions have? Can you point to a function?
--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
asdf wrote:True or false ?This question seems to be about how the c++ community defines the
"object" concept.
I would say "false". Here''s why.
The * symbol is used for dereferencing or defining a pointer to an
object.
However, the * symbol is also used to define a pointer to a function.
So, if a function is not an object, what is the type-of-thing that a
pointer to a function points to?
I would say that a pointer-to-a-function is an example of a
pointer-to-an-object, and hence a function is an object.
Paul Epstein
这篇关于功能不是一个对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!