- #1
Potential
- 11
- 0
C++ -- Nested Classes
A post or two I have been working with appeared to be associated with students in a C computer language programming course. In other words, the class may have not been object oriented. Also, mentioned in one post was the concept of housekeeping being less important than the actual logic of producing correct results, at least in a Computer Science class. I would like to address both of these issues from a standpoint of who the type of person I would hire. I am surprised C is being taught instead of C++ and that housekeeping is considered less important that the ultimate result producing logic.
If I were hiring right now, I would want the type of programmer that knows C++ object oriented programming. Once I find these types of people, I then look at their housekeeping habits, such as not having memory leaks, always initializing every variable or object, and always checking NULL pointers prior to being used. If a potential prgrammer has these abilities, they are considered for the job and if they don't, the resume goes on the 'other' stack.
Now on to a an open discussion of object oriented programming, which in my opinion should be taught. Here is an example:
Over the years, I have used nested classes and non-nested classes in an actual production environment. I have found advantages and disavantages in using both concepts.
Using non-nested inheritance...
Using nested without inheritance...
I would really enjoy reading all comments and discussing object oriented technologies.
A post or two I have been working with appeared to be associated with students in a C computer language programming course. In other words, the class may have not been object oriented. Also, mentioned in one post was the concept of housekeeping being less important than the actual logic of producing correct results, at least in a Computer Science class. I would like to address both of these issues from a standpoint of who the type of person I would hire. I am surprised C is being taught instead of C++ and that housekeeping is considered less important that the ultimate result producing logic.
If I were hiring right now, I would want the type of programmer that knows C++ object oriented programming. Once I find these types of people, I then look at their housekeeping habits, such as not having memory leaks, always initializing every variable or object, and always checking NULL pointers prior to being used. If a potential prgrammer has these abilities, they are considered for the job and if they don't, the resume goes on the 'other' stack.
Now on to a an open discussion of object oriented programming, which in my opinion should be taught. Here is an example:
Over the years, I have used nested classes and non-nested classes in an actual production environment. I have found advantages and disavantages in using both concepts.
Using non-nested inheritance...
Code:
class Force
{
public:
Force();
virtual ~Force();
protected:
};
class NuclearForce : public Force
{
public:
NuclearForce();
virtual ~NuclearForce();
protected:
};
class ElectronForce : public Force
{
public:
ElectronForce();
virtual ~ElectronForce();
protected:
};
Using nested without inheritance...
Code:
class Force
{
public:
Force();
virtual ~Force();
class NuclearForce
{
public:
NuclearForce ();
virtual ~NuclearForce();
protected:
};
class ElectronForce
{
public:
ElectronForce();
virtual ~ElectronForce();
protected:
};
protected:
};
I would really enjoy reading all comments and discussing object oriented technologies.