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