---
title: "Discussion on \"设计模式（二）——创建型：工厂模式-区分变与不变\" | Hashnode"
description: "Discussion on \"设计模式（二）——创建型：工厂模式-区分变与不变\". 浅谈构造器\n构造器代码示例：\nclass User {\n  name: string;\n  age: number;\n  carrer: string;\n\n  constructor(name: string, age: number, career: string) {\n    this.name = name;\n    this.age = age;\n    this.carrer = career;\n  }\n}\n\nconst user = new User(\"suxiong\", 24, \"..."
url: "https://hashnode.com/posts/6k66k6h5qih5byp77yi5lqm77yj4ocu4ocu5yib5bu65z6l77ya5bel5y6c5qih5byplewmuuwihuwpmos4jus4jewpma/6322dc56633ce488662d9cb6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [设计模式（二）——创建型：工厂模式-区分变与不变](https://yesx.hashnode.dev/6k66k6h5qih5byp77yi5lqm77yj4ocu4ocu5yib5bu65z6l77ya5bel5y6c5qih5byplewmuuwihuwpmos4jus4jewpma?utm_source=hashnode&utm_medium=feed)

浅谈构造器 构造器代码示例： class User { name: string; age: number; carrer: string; constructor(name: string, age: number, career: string) { this.name = name; this.age = age; this.carrer = career; } } const user = new User("suxiong", 24, "...

Sep 15, 2022 · 2 min read · yesx.hashnode.dev  
Read the article

-   [#6k66k6h5qih5byp](https://hashnode.com/tag/6k66k6h5qih5byp)

## Written by

[Yesx](https://hashnode.com/@hewuhu)

@hewuhu · china

  
[View profile](https://hashnode.com/@hewuhu)

RECORD SHARE GROWTH

新时代农民工一枚

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
