Thread: Calling Base Class Functions

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    8

    Calling Base Class Functions

    Could someone please tell me how to call base class functions from a derived class function with the same name?

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    95
    You need to prefix your declaraiton in the prototype with: virtual.
    Did you do that? Maybe you would use the scope resolution operator ::

  3. #3
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Yeah.. you need to use the base class name

    Code:
    void Derived::func(int a) {
        Base::func(a);
    }
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    8
    Thank you Will try this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Virtual base class
    By George2 in forum C++ Programming
    Replies: 7
    Last Post: 03-14-2008, 07:45 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. simple question
    By SuperNewbie in forum C++ Programming
    Replies: 2
    Last Post: 01-24-2005, 03:03 PM
  4. Virtual Base Class & Constructor :: C++
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 09-13-2002, 03:14 PM
  5. Difficulty superclassing EDIT window class
    By cDir in forum Windows Programming
    Replies: 7
    Last Post: 02-21-2002, 05:06 PM