Help! v.AdvancedC++

Discussion in 'OT Technology' started by Virt, May 6, 2007.

  1. Virt

    Virt OT Supporter

    Joined:
    Oct 5, 2005
    Messages:
    19,582
    Likes Received:
    44
    Alright, I've been doing C/C++ development for over 5 years now. I've been feelin pretty good about my l33t skillz. Then I went on several interviews, phone screens, and placement exams and have been getting CREAMED. Humbling as it was, I turn to OT for help. Can anyone point me towards an advanced or comprehensive C++ tutoring website? Preferable with online quizzes and such. Also, Start throwing random C++ questions in here to try to stump me. I'll give you a :cookie: if you do. Focuses on Virtual and static functions, polymorphism, data object pros and cons, inheritance, as hard as you can make it. Thanks!
     
  2. skinjob

    skinjob Active Member

    Joined:
    Jan 6, 2001
    Messages:
    2,337
    Likes Received:
    0
    Location:
    Aztlán
    Take a look at a book called "Effective C++" by Scott Meyers. Has a lot of good tips and do's and dont's type of info regarding intermediate to advanced C++ topics. There is a book called "Exceptional C++" by Herb Sutter for even more advanced topics as well as follow-ups to both books: "More Effective C++" and "More Exceptional C++."
     
  3. samm

    samm Next in Line

    Joined:
    Dec 22, 2000
    Messages:
    2,630
    Likes Received:
    0
    Location:
    San Jose, CA
    1. explain the purpose of virtual inheritance and how it solves the 'dreaded diamond' problem
     
  4. Virt

    Virt OT Supporter

    Joined:
    Oct 5, 2005
    Messages:
    19,582
    Likes Received:
    44
    Is this a commonly asked question? I seem to run into this one alot.

    Diamond problem:

    class A

    class B : public A;

    class C: public A;

    class D: public A, public B

    By this setup, class D would inherit members class A through class B AND class C. Any function call to methods inherited from class A from class D would be ambiguous, and you'd get a compilation error. Virtual inheritance (put the virtual keyword in front of the public keyword in the definitions of class B and class C) solves this by making sure the system only creates one instance of inherited members of class A when creating objects of class D.

    The way this works is in memory: instead of creating the class A object over and over again when calling the child classes, the compiler assigns a virtual method table pointer to the place of the class A object in the "middle" tiered classes. This causes a bit more overhead (more levels of indirection to access class A members), but resolves the ambiguity issue.

    Next!
     
  5. Virt

    Virt OT Supporter

    Joined:
    Oct 5, 2005
    Messages:
    19,582
    Likes Received:
    44
    Thanks a bunch. I'll look those up at first opportunity. :)
     
  6. GOGZILLA

    GOGZILLA Double-Uranium Member

    Joined:
    Jan 16, 2003
    Messages:
    10,760
    Likes Received:
    3
    Location:
    Plantation, FL
    what questions were you missing? give us some examples
     
  7. Virt

    Virt OT Supporter

    Joined:
    Oct 5, 2005
    Messages:
    19,582
    Likes Received:
    44
    It was quite embarassing actually, and I don't remember much of it. I wasn't given the correct answer to the questions, but some I had figured out were incorrect included:

    The differences between Class and struct
    What's a pure virtual function
    Proper useage of const
    static_cast, dynamic_cast


    The list goes on :(. I've studied up on all those I listed, plus a bunch more, now I'm just looking for someone to help quiz me. I've got an interview with paypal on tuesday..... Cram time! I've still got things like linked lists and hash tables and arrays (definition, pros, cons) to review.
     

Share This Page