Features of the "C #" constructor

Source: Internet
Author: User

1. Its function name is the same as the class name;
2. It can be overloaded;
3. Cannot specify a return type, even if it is void;
4. Although in general, constructors are not explicitly called, they are called automatically when an object is created. However, it is not possible to display the call. Sometimes it is necessary to display the call, as long as the parent class has a constructor with parameters, the constructor for calling the parent class must be displayed in the subclass, because the constructor of the subclass cannot find the constructor of the parent class when it is instantiated (the subclass does not have to show the call when the parent class has its own write-without-argument constructor).

 Public Base () {    this"webservicetest.testservice";}

Features of the "C #" constructor

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.