Search:

Type: Posts; User: Elysia

Search: Search took 0.14 seconds.

  1. Replies
    24
    Views
    5,807

    Why would a Dog need Cat functions? If it needs...

    Why would a Dog need Cat functions? If it needs that, then the design should be flawed.
    You should try to keep functionality that both classes need in a common base class, but it should also be...
  2. Replies
    24
    Views
    5,807

    There's also still two problems in the code: 1)...

    There's also still two problems in the code:
    1) You are creating an Animal. Animal != Dog. So you are treading a very fine line when you're casting the Animal into a Dog. It's would be another thing...
  3. Replies
    24
    Views
    5,807

    Several issues... You are trying to convert a...

    Several issues...
    You are trying to convert a pointer to a non-pointer. You want to change the type of your Animal* to Dog* (both pointers). Use dynamic_cast for this, because we're working with...
  4. Replies
    24
    Views
    5,807

    This is polymorphism, btw, a separate topic....

    This is polymorphism, btw, a separate topic.
    Since Dog inherits from Animal, it is also an Animal, thus you can convert a Dog into an Animal without problems, no casting required. That's not always...
  5. Replies
    24
    Views
    5,807

    Because you try to dereference a non-pointer? o_O

    Because you try to dereference a non-pointer? o_O
  6. Replies
    24
    Views
    5,807

    You can add as many constructors as you want....

    You can add as many constructors as you want.
    The form would be:
    Dog(const Animal& rhs)
    Dog is the constructor (naturally), which must take an Animal as argument (the object which it's going to...
  7. Replies
    24
    Views
    5,807

    It says EITHER a) No constructor could do the...

    It says EITHER
    a) No constructor could do the conversion
    b) Constructor overload was ambiguous (two or more constructors was found that could do the conversion, but the compiler couldn't choose a...
Results 1 to 7 of 7