Keith Thompson said:
Paul said:
Keith Thompson said:
[...]
Its quite simple and clear what I mean, I will explain:
Objects can and, more often than not, do contain member functions. To
suggest that objects do not contain functions is complete nonsense.
My newsreader doesnt like to indent your text so sorry about that.
[...]
Your newsreader's failure to quote properly makes it difficult to
figure out who wrote what, so I'll just respond to this one paragraph.
You might want to investigate why your newsreader is malfunctioning,
and perhaps consider using a different one. You might also consider
trimming excessive quoted material.
Yes, what you mean is quite simple and clear. It's also quite wrong,
at
least if you use the word "object" as it's defined by the C++
standard.
Quoting the 2003 version of the ISO C++ standard, section 1.8:
An object is a region of storage. [Note: A function is not an
object, regardless of whether or not it occupies storage in the way
that objects do.]
(The word "object" is in italics, indicating that this is the
standard's
definition of the word. The second sentence does not directly refute
your claim; I include it for completeness.)
And what part of this do you interpret to mean ... objects cannot
contain member functions?
All this says is that an object is a region of storage.
I can't understand why you think this says something other than that.
Yes, all it says is that an object is a region of storage. What makes
you think I think it says anything else?
Because you obviously used it as an argument to say that I was wrong.
Yes, I did. Because, in my opinion, you *are* wrong. Does that
possibility never cross your mind?
Yes, it does.
A function is not an object, regardless of whether or not it
occupies storage in the way that objects do.
The "whether or not" implies at least the possibility that a function
might not occupy storage in the way that an object does.
No it implies that a function might occupy storage in the same way , you
imply the negative.
Yes, they do. I wish I could help you to understand that.
I use these words as defined in the english dictionary , how do you use
them?
Yes, of course I am. These newsgroups discuss C++, which is defined by
the C++ standard. Using terms as the C++ standard defines them is
perfectly appropriate. Why do you think otherwise?
Because the standards were written in a context, general programming
discussions are not carried out in the same context.
It doesn't make any difference anyway because the standards support my
argument.
It is the definition in the C++ standard. If you think it's a bad
definition, you're certainly entitled to your opinion, but I suggest
that you should at least acknowldge that it's a valid meaning
for the word "object" *in the context of C++*.
No the standard defines an object as a region of storage, your
interpretation of this seems to be that an object is nothing more than a
region of storage.
Note that a variable of type int is also an "object". The C++
standard uses the word "object" in a way that's not related to
object-oriented programming.
The word variable used almost 300 times in the C++ standard?
I don't think you understand the C++ object model at all.
If you want to talk about OO-style "objects", I suggest that (a)
you define just what you mean by that, and (b) choose a different
term to avoid confusion.
No I will discuss Object Orientated programming as defined in the C++ Object
model.
I repeat the above question: Can you at least understand that the sense
in which a data member is part of an object does not entirely apply to a
member function? So far the answer seems to be that you're incapable of
understanding that. By all means, prove me wrong.
No I can't understand why you think this.
An object is not limited to the contents of the storage region it occupies..
[...]
Please do not confuse a member function being part of an object as
meaning the functions code is stored within the object in memory.
That's exactly what most of us thought you were trying to say, which is
why we've been telling you you're wrong.
Please can you list a few of the people you mean by "most of us" and
lets see if they agree with you. Because if you thought that a runtime
object shares the same memory space as a function definition you have
a heck of a lot to learn about programming mate.
I'm not so sure many people would like to step up and admit to that.
No, nobody here believes that a function definition (or, as you
corrected in a followup, "function code") shares the same memory space
as an object of the class that defiens the function.
So why have you argued that a member function is not a part of the object
because it's not contained within the objects storage region?
But your repeated claims that an object "contains" member functions,
along with the correct definition of a C++ object as "a region
of storage", led at least some of us to believe that you thought so.
A member function is part of an object, this is a fact not a claim.
I quote your text:
<quote>
An object is a region of storage. That's all it is. For something to
be *part of* an object (or, equivalently to be contained within an
object), it has to be somewhere within that region of storage.
Something outside the region of storage may well be associated with the
object, but it's not *part of* the object.
For example, a data member really is *part of* an object.
</quote>
Your interpretation of the C++ standard is not only a very incorrect but
also seems very narrow minded, negative and bias.
The C++ Standard does not state what you say but it cleary states the exact
opposite.
<quote src="C++ Standard">
1.8 The C++ object model [intro.object]
2 Objects can contain other objects, called subobjects. A subobject can be a
member subobject (9.2)
</quote>
<quote src="C++ Standard">
9.2 Class members [class.mem]
1 The member-specification in a class definition declares the full set of
members of the class; no member
can be added elsewhere. Members of a class are data members, member
functions (9.3), nested types,
and enumerators. Data members and member functions are static or non-static;
see 9.4
And there is more.
</quote>
I think you have a very poor understanding of the words and terms used in
the C++ standards.
Good Luck!