Writes 4 methods of the same name, implements two integers, two real numbers, a real number, an integer, and an integer sum of a real number. Call these 4 methods in the keynote function to calculate the related values. (Overloading of methods)

Source: Internet
Author: User

1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.Linq;4 usingSystem.Text;5 usingSystem.Threading.Tasks;6 7 namespaceConsoleApplication78 {9     class ProgramTen     { One         Static voidMain (string[] args) A         { -             //Add integers -             intA =1; the             intb =3; -             intsum =Test (A, b); -Console.WriteLine ("integer addition: {0}+{1}={2}", A, b, sum); - Console.WriteLine (); +             //Add real numbers -             Doublec =2.5; +             DoubleD =5.2; A             DoubleSUM1 =Test (c, D); atConsole.WriteLine ("sum of real numbers: {0}+{1}={2}", C, D, sum1); - Console.WriteLine (); -             //real numbers plus integers -             DoubleE =3.5; -             intf =6; -             Doublesum2 =Test (E, f); inConsole.WriteLine ("real number plus integer: {0}+{1}={2}", E, F, sum2); - Console.WriteLine (); to             //integer plus real number +             intg =8; -             Doubleh =9.9; the             DoubleSUM3 =Test (g, h); *Console.WriteLine ("integer plus real number: {0}+{1}={2}", G, H, sum3); $ Console.WriteLine ();Panax Notoginseng  - Console.readkey (); the         } +  A         Static intTest (intAintb) the         { +             intsum = a +b; -             returnsum; $         } $         Static DoubleTest (DoubleADoubleb) -         { -             Doublesum = a +b; the             returnsum; -         }Wuyi         Static DoubleTest (DoubleAintb) the         { -             Doublesum = a +b; Wu             returnsum; -         } About         Static DoubleTest (intADoubleb) $         { -             Doublesum = a +b; -             returnsum; -         } A     } +}

Writes 4 methods of the same name, implements two integers, two real numbers, a real number, an integer, and an integer sum of a real number. Call these 4 methods in the keynote function to calculate the related values. (Overloading of methods)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.