Wednesday, June 23, 2004

Relearning C++ and Random Thoughts

As I read some code at work today, code written in C++ I find myself at a bit of a loss. So, what I'm learning I will write down and hopefully I will start coding soon.

using namespace MAIN
using software components from the MAIN Libaries
- make libiries unique from one another
- if 2 libs have the same methods qualify the namespace
- each namespace defines a scope where a global identifier and global variables are placed.

fully qualify namespace calls
namespace MAIN::member


extern "C" function prototype
extern "C" { BLOCK }
- tell the compiler don't do the above in C++ do it at linker time

virtual - Polymorphism / Dynamic allocaed objects - keywords
in use with destructors in an inherited situation calling delete on an object will use the BASE CLASS destructor. This is not good. Use virtual ~class to get around calling the base class destructor and its own.

declaired const by both in its prototype and its definition by inserting the keyword after the functions parameter list.
OBJECT function const { BLOCK }

Object Pointers
Object *objectPTR, object, objectref;

objectPTR = &object
(*objectPTR).member == objectPTR->member. This syntax is needed because the dot operator has higher precense then the above 2 versions of the syntax.


Post a Comment

<< Home