Help w/inheritance and virtual funcs PLEASE!!!

This is a discussion on Help w/inheritance and virtual funcs PLEASE!!! within the C++ Programming forums, part of the General Programming Boards category; Hello, OK, Here's my problem. I have created a base class CBaseAnimal that has a virtual function in it. Here's ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    17

    Help w/inheritance and virtual funcs PLEASE!!!

    Hello,

    OK, Here's my problem. I have created a base class CBaseAnimal that has a virtual function in it. Here's its def:

    class CBaseAnimal {
    public:
    virtual void speak() =0;
    };

    Now I derive a class CDog based on CBaseAnimal:

    class CDog : public CBaseAnimal {
    };

    NOW I define speak():
    void CDog::speak()
    {
    cout << "BARK BARK!";
    }

    When I compile (using VC++6), I get the error SetName' : member function not declared in 'CHumanPlayer''!! Shouldn't it be because I derived CDog FROM CBaseAnimal??? PLEASE HELP ME!!!!
    ------------------------------------------
    Normally I'd put something clever, but that isn't the point of being here now is it?

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    A. We don't see where SetName is declared
    B. We don't see where SetName is used

    Post more relevant snippets if you want real help.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  3. #3
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125
    Where is the code that uses the class CHumanPlayer?
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Where is the Humanity?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Virtual Box
    By ssharish2005 in forum Tech Board
    Replies: 3
    Last Post: 02-12-2009, 05:08 AM
  2. Replies: 48
    Last Post: 09-26-2008, 04:45 AM
  3. Program with Shapes using Virtual Functions
    By goron350 in forum C++ Programming
    Replies: 12
    Last Post: 07-17-2005, 02:42 PM
  4. C++ XML Class
    By edwardtisdale in forum C++ Programming
    Replies: 0
    Last Post: 12-10-2001, 11:14 PM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 02:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21