1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16
17class C {
18  #value: number = 0;
19  #add() {
20    this.#value += 1;
21  }
22  publicAdd() {
23    this.#add();
24  }
25  publicPrint() {
26    print(this.#value);
27  }
28
29  static #message: string = "hello";
30  static #say() {
31    return this.#message;
32  }
33  static publicSay() {
34    print(this.#say());
35  }
36
37  get #data() {
38    return this.#value;
39  }
40  set #data(num: number) {
41    this.#value = num;
42  }
43  get publicData() {
44    return this.#data;
45  }
46  set publicData(num: number) {
47    this.#data = num;
48  }
49
50  static get #msg() {
51    return this.#message;
52  }
53
54  static set #msg(msg: string) {
55    this.#message = msg;
56  }
57
58  static set publicMsg(msg: string) {
59    this.#msg = msg;
60  }
61  static get publicMsg() {
62    return this.#msg;
63  }
64}
65
66let c: C = new C();
67c.publicAdd();
68c.publicPrint();
69C.publicSay();
70c.publicData = 20;
71print(c.publicData)
72C.publicMsg = 'hi';
73print(C.publicMsg);
74
75