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. C#
  4. Method overloading

Method overloading

Scheduled Pinned Locked Moved C#
tutorial
6 Posts 5 Posters 0 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.
  • I Offline
    I Offline
    i gr8
    wrote on last edited by
    #1

    How to access particular method in overloading E.g: 2 overloaded method as follows

    Method1(double, double)
    Method1(int, int)

    calling method:

    Method1(1,1)

    Here from calling function i want to access Method1 with "double". how can we achieve this.

    A D P 3 Replies Last reply
    0
    • I i gr8

      How to access particular method in overloading E.g: 2 overloaded method as follows

      Method1(double, double)
      Method1(int, int)

      calling method:

      Method1(1,1)

      Here from calling function i want to access Method1 with "double". how can we achieve this.

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #2

      Cast the variables to the expected type, as follows:

      Method1((double)1, (double)1);

      [Forum Guidelines]

      1 Reply Last reply
      0
      • I i gr8

        How to access particular method in overloading E.g: 2 overloaded method as follows

        Method1(double, double)
        Method1(int, int)

        calling method:

        Method1(1,1)

        Here from calling function i want to access Method1 with "double". how can we achieve this.

        D Offline
        D Offline
        darkelv
        wrote on last edited by
        #3

        Method1(1d,1d)?

        1 Reply Last reply
        0
        • I i gr8

          How to access particular method in overloading E.g: 2 overloaded method as follows

          Method1(double, double)
          Method1(int, int)

          calling method:

          Method1(1,1)

          Here from calling function i want to access Method1 with "double". how can we achieve this.

          P Offline
          P Offline
          PSK_
          wrote on last edited by
          #4

          Method1(1,1)

          This will by default call Method1(int, int).

          Regards, Prakash Kalakoti

          A P 2 Replies Last reply
          0
          • P PSK_

            Method1(1,1)

            This will by default call Method1(int, int).

            Regards, Prakash Kalakoti

            A Offline
            A Offline
            AspDotNetDev
            wrote on last edited by
            #5

            The OP wanted to call the double version, not the int version.

            [Forum Guidelines]

            1 Reply Last reply
            0
            • P PSK_

              Method1(1,1)

              This will by default call Method1(int, int).

              Regards, Prakash Kalakoti

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              Duh.

              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