>>I agree with your definition with the exception that in C++, a structure can have member functions (aka methods).
>
>Umm, no. A structure can contain a pointer to a function, but a structure will not directly contain methods. As the gentleman from Georgia has pointed out, structures are contiguous blocks of memory, and it's kind of hard to squeeze a function into something that is a predefined block.
C++ structure definitions can contain functions. Of course the functions are not actually in the block of data, they do exist in the declaration and are available to any C++ code that uses the declaration.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement