Added code for visitor pattern, fixed compile issues.

what's this?