Thread: Forgot how to use base class properly

  1. #1
    Disturbed Boy gustavosserra's Avatar
    Join Date
    Apr 2003
    Posts
    244

    Forgot how to use base class properly

    Hi everyone. I completely forgot how to access base class functions, even if I overload it, is it using the :: operator?
    Code:
    class Base{
    protected:
        void f();
    };
    
    class Inh : public Base{
    public:
        void f(){
            //do new stuff here
            //call Base::f()
        }
        
    };
    Thanks any help!
    Nothing more to tell about me...
    Happy day =)

  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Yep that's the correct syntax. Doesn't it work?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Maybe you want to make it virtual in the base class?
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  4. #4
    Disturbed Boy gustavosserra's Avatar
    Join Date
    Apr 2003
    Posts
    244
    Quote Originally Posted by bennyandthejets
    Yep that's the correct syntax. Doesn't it work?
    I didn't try it, sorry.
    I'll try it. (what a shame!!!!!)
    Nothing more to tell about me...
    Happy day =)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. derived class can not access base class protected member?
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 10-21-2007, 06:32 PM
  2. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  3. Base class initialization
    By VirtualAce in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2004, 04:52 AM
  4. Calling constructor of the base class of a derived class..
    By CaptainPenguin in forum C++ Programming
    Replies: 5
    Last Post: 02-19-2003, 01:47 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM