FAQ (frequently asked questions) for Assignment 1
Last updated Mon Mar 12 18:04:22 HKT 2001

Q.  What libraries can I include in my program, e.g.,
#include <string> or #include <cctype>?
A. You can use whatever libraries you want as long as it will compile under
the standard g++ compiler on the labs machines, e.g.,   using the command
        g++ building.cpp CheckBuilding.cpp
and we can call the member functions using the interface we gave you.

Q.  In what order should the names be printed by the overloaded <<?
A.  In whatever order you like.

Q.  If a room is already occuppied and another person is being `put'
into it should we print an error message.
A.  No.  All you need to do is remove the first person from the room
and insertthe second one.

Q. Should we write a copy constructor or destructor for the building class
A. We do not explicitly state that you should write a copy constructor or
destructor for the class and it is not required that you do so. We
will not explicitly call the copy constructor when we are checking your

   BUT, if you use dynamically allocated data in your class you must
be careful to write your program correctly so that it does not cause
`dangling pointer' or `memory leakage ' problems.  Depending upon
how you implement your class you might need to include an overloaded
copy constructor of destructor instead of relying on the default
one generated by the system.

Q.  How should the alphabetical order for Display() work when there
are upper case letters and special symbols, e.g.,  *,&,#, etc, in
the names.
A. You can decide what EXTENDED alphabetical order you want to use.
As long as
                a < b < c ... < z
                A < B < C . . .< Z
it will be fine (we will not check other types of cases).

Q. I tried running your code under VC++ and it did not compile.
It told me that the friend function can not access private members.
What should I do.
A.  The simple answer is that you should try running the program under
g++ on the labs computers.
    The more complicated answer is that there is a known bug in
the implementation of friend functions in some versions of VC++.
Microsoft has provided a fix for this bug but many older versions
of VC++ have not been patched which is probbaly why you are getting
the error messages.  See


(Thanks to Martin Law for digging this up)

Q.   Can I add a new class/struct besides my building class?
       Can I add new member functions to the class Building?
A.  You may,  BUT,  your changes may NOT modify our interface.
That is,  when we compile and link our driver to your building.h and
building.cpp the output we get when we run the program must be the
same as if you had not added the new member functions, classes/structures.
        For new member functions,  it would be good programming style to make
them private, since they are not supposed to be used by others.
         Rinally,  if you add new members, etc., you must clearly DOCUMENT
them so that we understand what they are and what they do.