cangjie-class

Explain class definition, instantiation, and inheritance in Cangjie.

2|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/zhenzhizhi12/NexusAgent --skill cangjie-class-zhenzhizhi12
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-class
Source: https://github.com/zhenzhizhi12/NexusAgent/tree/main/.opencode/skills/common-skill-l1/class
Command: npx skills add https://github.com/zhenzhizhi12/NexusAgent --skill cangjie-class-zhenzhizhi12

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides comprehensive guidance on defining, inheriting from, and utilizing classes in the Cangjie programming language, simplifying complex object-oriented programming tasks.

Core Features & Use Cases

  • Class Definition: Learn syntax for basic, abstract, and sealed classes.
  • Members: Understand instance/static variables, properties, and functions.
  • Constructors & Destructors: Master init and ~init for object lifecycle management.
  • Inheritance & Polymorphism: Grasp override, redef, and access modifiers (private, internal, protected, public).
  • Use Case: When developing a new feature in Cangjie that requires complex data structures, use this Skill to correctly define and implement the necessary classes, ensuring proper encapsulation and inheritance.

Quick Start

Explain how to define a basic class with a constructor and a member variable in Cangjie.

Frequently Asked Questions about cangjie-class

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

FAQPage Schema
How do I define a class in Cangjie with a constructor and member variables?

To define a class in Cangjie, you declare the class structure and use the `init` constructor to initialize member variables. This Skill details the exact syntax for basic class definition and object lifecycle management.

What is the difference between abstract and sealed classes in Cangjie?

Abstract classes in Cangjie provide a base for subclasses to inherit from, while sealed classes restrict which classes can inherit from them. This Skill explains the syntax and specific use cases for both class types.

How do I override and redefine instance and static methods in Cangjie?

Overriding instance methods and redefining static methods in Cangjie requires specific modifiers to achieve polymorphism. This Skill covers the exact usage of `override` and `redef` keywords for method behavior modification.

Does Cangjie support access modifiers like private and protected for class encapsulation?

Cangjie supports access modifiers including `private`, `internal`, `protected`, and `public` to control class member visibility. This Skill explains how to apply these modifiers to ensure proper encapsulation in object-oriented programming.

How do destructors work in the Cangjie programming language?

Destructors in Cangjie are defined using the `~init` syntax to handle object lifecycle cleanup. This Skill details how to implement destructors alongside primary and secondary constructors for resource management.

When should I use the `This` type in Cangjie class inheritance?

The `This` type in Cangjie is used within class hierarchies to refer to the concrete type of the current instance. This Skill explains its application in overriding methods and designing robust object-oriented structures.