Saturday, November 7, 2009

starting assignment2

Putting together the assignment 2 skeleton, so that my questionably devoted group can start working was a joyous learning experience (read: horrendous aneurysm inducing experience).

After crawling through the classes and creating the header files. I was introduced to the joy of including the assignment 2 structure into our project(cpp and header files). Meaning the mess of my circular includes AND lack of includes through use of undeclared identifiers.

Basically there a few rules for handling includes:

In Header Files
  • use forward declarations when you can. Meaning if you only refer to the class you can use this option.
  • #include "*.h" your base classes.
  • In our case because we have need identifiers from io_def.h, we should include that in every necessary header file.

In Cpp Files
  • #include "*.h" your respective header file ie: inslude io_form.h in io_form.cpp.
  • #include "*.h" your forward declarations from your included header file.
io_form.h for example:

#ifndef __IO_FORM_H
#define __IO_FORM_H
#include "io_frame.h"
#include "io_def.h"

class IO_Field;
class IO_Label;
class IO_Form : IO_Frame{





And io_form.cpp:

#include "io_field.h"
#include "io_label.h"
#include "io_form.h"



I hope this helps somebody! Next on the to do list: divide Assign2 and fix << operators and my mess with pure virtual functions.

No comments:

Post a Comment