cangjie-class

Explain Cangjie class constructs including abstract classes, constructors, destructors, inheritance, and members.

4|1|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/JunjieChen0/NJUST --skill cangjie-class-junjiechen0
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-class
Source: https://github.com/JunjieChen0/NJUST/tree/main/.njust-ai/skills/cangjie-class
Command: npx skills add https://github.com/JunjieChen0/NJUST --skill cangjie-class-junjiechen0

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

帮助开发者理解和使用仓颉语言的类定义、抽象类、构造函数、终结器、继承与多态、成员变量和属性、访问修饰符以及 This 类型等面向对象特性,从而在实际项目中正确建模和实现复杂对象。

Core Features & Use Cases

  • 类定义、实例与静态成员的用法与约束
  • 抽象类、主构造函数、终结器 (~init) 的设计要点与使用场景
  • 继承、重写、重定义以及 This 类型在实际设计中的应用

Quick Start

Create a simple class hierarchy in Cangjie that demonstrates abstract classes, constructors, destructors, inheritance, override, and property definitions.

Frequently Asked Questions about cangjie-class

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define an abstract class and implement inheritance in Cangjie?

Cangjie supports abstract classes and inheritance for building class hierarchies. You define abstract members in the base class and implement them in derived subclasses using override rules for proper object-oriented modeling.

What is the difference between instance and static members in Cangjie classes?

Cangjie distinguishes instance members, tied to specific objects via constructors, from static members bound to the class type. Access modifiers control visibility for both, ensuring proper encapsulation in object-oriented design.

How do constructors and destructors work in the Cangjie language?

Cangjie constructors initialize class instances, with the primary constructor defining core properties. Destructors use the ~init syntax to manage resource cleanup before the object is garbage collected.

How does the This type work when overriding methods in a Cangjie class hierarchy?

The This type in Cangjie represents the exact runtime type of the current instance. It ensures type safety during inheritance and redefinition, enabling precise method overriding in complex class hierarchies.

What are the limitations of using access modifiers in Cangjie object-oriented programming?

Cangjie access modifiers restrict member visibility to enforce encapsulation within classes. However, they cannot bypass abstract class rules or eliminate required primary constructor calls during object creation.