Wednesday, August 23, 2006

Another interview

Here is what I was asked

  1. what is virtual inheritance?
  2. what is a singleton?
  3. what is a factory?
  4. why would you use the virtual key word on a function?
  5. what is explicit?(only useful for constructors with a single parameter)
  6. how would you reduce disc access in a program?
  7. difference between struct and class in C++ , in C#?
and some other questions that I forget.

Appearantly I have to go to a second none technical interview with them, and if I don't screw up, I'll get this job. The interviewer said they do an intensive background check, including checking your credit! Hopefully, these guys aren't flakes like threewave software who ask for your references, check them, ask for your salary expectations, and then don't give an offer.

Monday, August 21, 2006

Some Interesting Things In C++

I found out some interesting things when making this persistent file based order tracking system which I was asked to code before an interview.
  1. In a copy constructor, if your Object(const Object & rhs) is not declared as const, you get an error saying: "no copy constructor available or copy constructor is explicit". This happens on VS.Net professional 2003 and might happen on other compilers. Interesting, I never thought the a compiler will complain (specially with a misleading error message) for not declaring something as const.
  2. To make integral type member data as consts, you must declare them as static const.
  3. Related to 2. To make static integral member data (which are not const), you must define it outside the class in C++ and use the scope resolution operator on it.
  4. Related to 2 and 3 . To declare Non integral member data (such as arrays or strings) as consts you must do 2. AND you must define them outside of the class like 3.
  5. Summary: Related to 2, 3, and 4. Only static const integral types can be defined inside the class. Any consts members must be static const. Any static members (except for static const integral members) must be defined outside the class with the scope resolution operator.
  6. by making a const function, you are telling the compiler, that I am not gonna change the (this) object inside this function.
I wrote this shit down, because if I didn't I would forget them in about 10 minutes...