Results 1 to 6 of 6

Thread: Confused about Overloading and OverRiding

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Answers
    1

    Confused about Overloading and OverRiding

    Tell what is exactly these words overloading overriding virtual pure virtual inheritance polymorphism and these are same or not overloading=polymorphism overriding=inheritance i am really confusion abt these


  2. #2
    Contributing Member
    Join Date
    May 2007
    Answers
    60

    Re: Confused about Overloading and OverRiding

    Hi,

    Overriding and Overloading both are examples for polymorphism overloading is a static polymorphism and Overriding is a dynamic polymorphism.

    Overrideing: Same methods name with same signature in both base class and derived class.

    Overloading: Same methods name with diffrent signature in base class.

    Inheritance: Using the all the features of base class in derived class.

    Regards,
    hari prasad

    Last edited by hari.nattuva; 06-05-2007 at 10:56 AM.

  3. #3
    Junior Member
    Join Date
    Jun 2007
    Answers
    9

    Re: Confused about Overloading and OverRiding

    hi ,
    overriding and overloading both comes under polymorphism ..
    overriding comes under runtime(dynamic) polymorphism.
    overloading comes under compiletime (static) polymorphism..
    in overriding the method name and signature is same but access modifier is same or wider than the base class acess modifier .. and if your throwing any exceptions the base class method throwing exception should be same or wider(means parent exception)than derived class throwing exception..

    Overloading:
    In overloading method name is same but signature is different ..


    plz if u have any issues let me know...


  4. #4
    Expert Member
    Join Date
    Nov 2006
    Answers
    518

    Re: Confused about Overloading and OverRiding

    Hay harisudhan, your question is already answered earlier in this forum.

    Please check that here

    http://www.geekinterview.com/talk/50...erloading.html

    Lack of WILL POWER has caused more failure than
    lack of INTELLIGENCE or ABILITY.

    -sutnarcha-

  5. #5
    Junior Member
    Join Date
    May 2007
    Answers
    15

    Re: Confused about Overloading and OverRiding

    Let me give one example.

    METHOD OVERLOADING

    class human(
    {
    void Hand(two paremeters){
    Eating}
    void Hand(three parameters) {
    Writing }
    void Hand(Five parameters) {
    Fighting }

    METHOD OVERIDING

    class father {

    void Hand(5 parameters){
    Smoking;
    }
    }
    class child extends father{
    void Hand(5 parameters){
    Drinking}


  6. #6
    Junior Member
    Join Date
    Jun 2008
    Answers
    3

    Re: Confused about Overloading and OverRiding

    frend
    there is two forms in polymorphism
    1.early or static binding
    2.dynamic or late binding
    basically binding means interface b/n functoncall n real function.
    in function overriding we use the concept of virtual function.
    means if we place virtual keyword before function in baseclass(we must write virtual function base class only)it becomes virtual to all the derived classes to it.that means it overrides the base class function
    that means it exicutes the function of derived class instead of base class.
    in this we write function of same type & arguments. if we pass differently it ignores it.
    where as in overloading we use the concept of static binding.that means it is fixed. we may not change. in this the no.of arguments & type
    are same,except function name. and it is in the same class.where as in function overriding we write same function definition in different .
    i don't know how i can explain u.
    but if u want more information please go through the book ASHOK N.KAMADHANE PEARSON PUBLISHERS it is easy in language and very lucid explanation.

    thank u
    REGARDS,
    SUHANA.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact