Some questions about C + + DELETE function

Source: Internet
Author: User

Previous projects have been useful in C + + code to delete functions ...

1 namespaceFramework2 {  3     classUtils Final4     {5     Private:6Utils () = delete;//Delete a function7      Public:8         9         //--------Ten         //Math One         //-------- A          -         //returns unrestricted random number, maximum 0x7fffffff -InlineStatic intrandom (); the          -         //returns the specified range of random numbers (range [Start, end]) -InlineStatic intRandomintMinintmax); -          +         //Rounding rounding values, supporting negative numbers -InlineStatic DoubleRoundDoubleNumber ); +     }; A}

As the code above, when a function is assigned to delete, the function is declared in order to delete the function, that is, it cannot be called. The parameterless constructor at the moment is declared as a delete function, which means that the system does not automatically generate constructors for this class, so the object of the class cannot be produced when externally used. The reason for this is because all the member functions of this class are declared for static methods, so there is no need to produce objects of that class, then force the user to not produce the object ...

A little problem with C + + DELETE function

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.