Two methods are defined in the Custom class, called each other, And called

Source: Internet
Author: User

Two methods are defined in the Custom class, called each other, And called

1 using System; 2 using System. collections. generic; 3 using System. linq; 4 using System. text; 5 6 namespace Test06 7 {8 // class Class1 9 // {10 // public string Country () 11 // {12 // string strCountry = "Example of the method! "; 13 // return strCountry; 14 //} 15 // public string stradd () 16 // {17 // Program myProgram = new Program (); 18 // string strField = myProgram. cc () + this. country (); 19 // return strField; 20 //} 21 //} 22 // class Program23 // {24 // public string Cc () 25 // {26 // string strCc = "this is a"; 27 // return strCc; 28 //} 29 // static void Main (string [] args) 30 // {31 // Class1 class1 = new Class1 (); 32 // Console. WriteLine (class1.stradd (); 33 //} 34 //} 35 class Class1 // Two Methods 36 {37 public string exam () 38 {39 string strexam = "Example of the method! "; 40 return strexam; 41} 42 public string add () 43 {44 Program program = new Program (); // instantiate 45 string stradd = program. xp () + this. exam (); 46 return stradd; 47} 48} 49 class Program 50 {51 public string xp () 52 {53 string kt = "this is a"; 54 return kt; 55 56} 57 58 static void Main (string [] args) // (string [] args) sequence. uppercase for Main !!! 59 {60 Class1 class1 = new Class1 (); // instantiate
61  Console.WriteLine(class1.add()); 

62 }

63 }

64

65 }

 

Related Article

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.