1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Help C++ Questions

Discussion in 'C++' started by zackary13, Apr 3, 2011.

  1. zackary13

    zackary13 New Member

    I have some questions that I need by tonight because my brother bet that I couldn't find these answers by tonight by asking people online and he said that people online wouldn't help so I would like to prove him wrong.

    Please number the questions if you answer, thanks

    • In C++, there is a function called "assert"

      What is it? and should you use it often? why? example?

    2. If we have a virtual function in our base class, can we change the modifier of the function?

    See the example

    class Base {


    virtual double calculateHealth() const;


    Our inherited class

    class Derived : public Base {


    int calculateHealth() const;


    Is this allow? why or why not?

    • What is slicing? Should you avoid it at all cost? If so, why? and what alternative should you consider if you decide to avoid slicing at all costs?

    4. You might have seen public and private inheritance.

    what's the different between the two?

    class RedBoss : public Enemy


    class RedBoss : private Enemy

    5. What's the different between the following?

    #define MAX_MENU 3


    const int MAX_MENU = 3;

    What's the up and down for using each? when do you use it?
  2. xpi0t0s

    xpi0t0s Mentor

    Seems a funny thing for your brother to demand. Are you sure it's really your brother and this isn't just a fancy way of getting people to do your homework for you? Try reading your course notes - this really is the best help I can give you (cos just answering the questions for you teaches you nothing about programming).
  3. zackary13

    zackary13 New Member

    Well thanks for at least responding but I am 15 years old and I am not part of any course involving this but I owed my brother 50 dollars because I posted on 3 different forums but only got two responses.
  4. xpi0t0s

    xpi0t0s Mentor

    Older brother, is he?

Share This Page