Home > Common Problem > body text

What language is Cocos2d written in?

Guanhui
Release: 2020-06-15 13:39:55
Original
7771 people have browsed it

What language is Cocos2d written in?

What language is Cocos2d written in?

Cocos2d is implemented using C, which is an inheritance of C language. This language can perform both procedural programming of C language and object-based programming characterized by abstract data types. , you can also perform object-oriented programming characterized by inheritance and polymorphism.

C Features

Support data encapsulation and data hiding

In C, classes support data encapsulation Tools and objects are the implementation of data encapsulation. C supports data encapsulation and data hiding by creating user-defined classes.

In object-oriented programming, data and functions that perform legal operations on the data are encapsulated together as a class definition. Objects are declared as variables of a given class. Each object of a given class contains a number of private members, public members and protected members specified by the class. Once a well-defined class is created, it can be viewed as a fully encapsulated entity that can be used as an integral unit. The actual inner workings of a class are hidden, and users of a well-defined class don't need to know how the class works, just how to use it.

Support inheritance and reuse

New types can be declared based on existing C classes. This is the idea of ​​inheritance and reuse. Through inheritance and reuse, you can organize the program structure more effectively, clarify the relationships between classes, and make full use of existing classes to complete more complex and in-depth development. The newly defined class is a subclass and becomes a derived class. It can inherit all non-private properties and methods from the parent class as its own members.

Support polymorphism

Use polymorphism to specify performance behavior for each class. Polymorphism forms a tree structure consisting of parent classes and their subclasses. Each subclass in this tree can receive one or more messages with the same name. When a message is received by an object of a class in this tree, the object dynamically determines some usage of the message to be given to objects of subclasses. This feature of polymorphism allows for the use of high-level abstractions.

The combination of inheritance and polymorphism can easily generate a series of similar but unique objects. Due to inheritance, these objects share many similar characteristics. Due to polymorphism, one object can have a unique representation and another object have another representation.

Recommended tutorial: "C#"

The above is the detailed content of What language is Cocos2d written in?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!