GeeksforGeeks » C/C++ Programming Questions

Does this program cover overriding in C++?

(4 posts)

Tags:

  1. geek4u
    guest
    Posted 1 year ago #

    #include<iostream>
    using namespace std;
    
    class base {
        public:
           int i;
           void show()
           { cout<<" i = "<<i; }
    };
    
    class derived: public base {
        public:
           int i;  /* variable overriding */
           void show() /* function overriding */
           { cout<<" i = "<<i; }
    };
    

    Is there any other way to override things in C++ ?

  2. Venki
    Moderator
    Posted 1 year ago #

    It is not overriding, just conceals the base class method.

  3. Geek4u
    guest
    Posted 1 year ago #

    Could u provide the example of overriding in C=+

  4. Venki
    Moderator
    Posted 1 year ago #

    A detailed explanation can be found on the following link,

    http://msdn.microsoft.com/en-us/library/0y01k918(VS.80).aspx


Reply

You must log in to post.

RSS feed for this topic