cocos2dx3.2 Drawing Method Small modified C + + final learning

Source: Internet
Author: User

today, using the COCOS2DX 3.2 version number to learn the drawing function,So I overloaded node's draw method. Found an error,

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvamhvbmxpz2h0/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
Click Method to enter under node to find the Draw () method after a final.


Below I briefly explain the use of a final
1 Final class: The final class cannot be inherited, so the member methods of the final class have no chance of being overwritten, and the default is final.

In the design
class, it is assumed that the class does not need to have subclasses, and the implementation details of the class do not agree to change. and confirm that this class will not be
extension, then it is designed as the final class. The final method cannot be overridden by the quilt class method, but can be inherited.
2 Final Method       if a class does not agree to its subclasses overriding a method, it can declare this method as the final method.      There are two reasons for using the final method      First, lock the method. Prevents the task from inheriting the class from altering its meaning and implementation.       second, funny. The compiler goes into an inline mechanism when it encounters a call to the final method, which greatly improves operational efficiency.
3 Final Change (constant)     A constant is represented by a final modified member variable, which can only be assigned once and the value cannot be changed after the assignment!

There are three types of final modified variables: static variables. instance variables and local variables. Represents three types of constants, respectively.
All we can't rewrite the draw () method, what do we do? Don't worry. I see the draw method below and
A draw method with a number of parameters.
So we are able to overload this method of taking the parameters to draw the rules.

cocos2dx3.2 Drawing Method Small modified C + + final learning

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.