Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Shadowing??

Shadowing??

Scheduled Pinned Locked Moved .NET (Core and Framework)
question
5 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rahithi
    wrote on last edited by
    #1

    Hi all, what is shawdoing? what is the difference b/w over loading & shadowing? i read this in mSDN but i am still confused with this concept. please can anyone explain me what is this Shadowing? Thanks in advance Rahi

    If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

    W K 2 Replies Last reply
    0
    • R Rahithi

      Hi all, what is shawdoing? what is the difference b/w over loading & shadowing? i read this in mSDN but i am still confused with this concept. please can anyone explain me what is this Shadowing? Thanks in advance Rahi

      If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

      W Offline
      W Offline
      WillemM
      wrote on last edited by
      #2

      By overloading a method you get an alternative for that method. By shadowing a method you simply hide the other version of the method and it becomes inaccessable.

      WM. What about weapons of mass-construction? "You can always try to smash it with a wrench to fix that. It might actually work" - WillemM

      R 1 Reply Last reply
      0
      • R Rahithi

        Hi all, what is shawdoing? what is the difference b/w over loading & shadowing? i read this in mSDN but i am still confused with this concept. please can anyone explain me what is this Shadowing? Thanks in advance Rahi

        If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

        K Offline
        K Offline
        karam chandrabose
        wrote on last edited by
        #3

        Overloading can occur with in the same class too, for eg: //Example for overloading public int addnumbers(int a, int b) { return a+b; } public int addnumbers(int a, int b, int c) { return a+b+c; } Method Hiding can happen only when inheritance comes to picture public class Maths { public Maths() { //.Ctor } public int addnumbers(int a, int b) { return a+b; } } public class TwoMaths : Maths { public TwoMaths() { //.Ctor } // This method hides the base class's method // if you create a object for TwoMaths class, the base class's // addnumber method cannot be called unless until you explicitly //cast TwoMaths' object in to Maths object public int addnumbers(int a, int b) { return a+b; } }

        R 1 Reply Last reply
        0
        • W WillemM

          By overloading a method you get an alternative for that method. By shadowing a method you simply hide the other version of the method and it becomes inaccessable.

          WM. What about weapons of mass-construction? "You can always try to smash it with a wrench to fix that. It might actually work" - WillemM

          R Offline
          R Offline
          Rahithi
          wrote on last edited by
          #4

          Thanks now i got to know what Shadowing is. When ever i post some question in this forum by expecting this type of answers but i am not receiving exact response from the forum members. They are asking to read from the sites and books etc., they are correct. Atleast they are showing me the way but after reading from the book only i am posting my questions here. Some times i got struck (hang-up) with some topics may be they are very simple. as i am new to this technology..i need simple explaination like what u dropped here for shadowing.... Thanks once again for ur response. Rahi

          If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

          1 Reply Last reply
          0
          • K karam chandrabose

            Overloading can occur with in the same class too, for eg: //Example for overloading public int addnumbers(int a, int b) { return a+b; } public int addnumbers(int a, int b, int c) { return a+b+c; } Method Hiding can happen only when inheritance comes to picture public class Maths { public Maths() { //.Ctor } public int addnumbers(int a, int b) { return a+b; } } public class TwoMaths : Maths { public TwoMaths() { //.Ctor } // This method hides the base class's method // if you create a object for TwoMaths class, the base class's // addnumber method cannot be called unless until you explicitly //cast TwoMaths' object in to Maths object public int addnumbers(int a, int b) { return a+b; } }

            R Offline
            R Offline
            Rahithi
            wrote on last edited by
            #5

            thanks for ur response. really ur example is very simple and clear. this will be a very good example for those candidates(like me) who are new to this .net technology i came to know what shadowing is with ur's and willem's explanation. now i can read some more about shadowing from books & Sites. Thanks once again, Rahi

            If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups