On Wednesday 26 March 2003 07:51 am, Jerry Feldman wrote:
On Tue, 25 Mar 2003 23:06:17 -0500
"Steven T. Hatton" firstname.lastname@example.org wrote:
I thought Bjarne Stroustrup did that. ;-)
He invented C++ and he also is an associate of Kernighan and Ritchie at Bell Labs.
I like what he is reported to have said regarding the defining features of OOP. 'Object Oriented Programming is good, so if it's good, it's Object Oriented.'
Not so. Each class you define (in a header file) contains functions (I prefer to call them methods). Those functions may be inline (and expanded at instanciation time), but larger functions that are not inline should be defined in a source module.
As I suspected, /inline/ has a special meaning within C++. It has to do with how the method/function is dealt with on the activation stack. By default all methods declared within the class body are inline.
Personally, I'm finding all this jumping back and forth between class.cpp and class.h rather burdensome, and I'm wondering why I should even do it. Why not just do everything within the class body and be done with it?
Whether a function should be inline or not depends on many factors.
I would like to hear your views on this. From my Java experience, it seems rather strange to define things about a class outside of the body.
Additionally, it is not imperative that all functions in a C++ program be class members.
This I understand. I just believe it is, in general, a bad idea.
-- Gerald Feldman email@example.com