1/* 2 * Copyright (c) 2022 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 16declare function print(str:any):string; 17 18class A { 19 name:string; 20 value:number; 21 constructor(name:string, value:number) { 22 this.name = name; 23 this.value = value; 24 } 25} 26class B extends A { 27 constructor(name:string, value:number) { 28 super(name, value); 29 } 30} 31 32var obj = new B("AOT", 123); 33print(obj.name); 34print(obj.value); 35 36class M { 37 constructor(value) { 38 this.stageValue = value; 39 } 40} 41class BM extends M { 42 constructor(value) { 43 super(value); 44 } 45} 46 47let mdf = new M(2); 48print(mdf.stageValue); 49for (let i = 0; i < 12; i++) { 50 mdf = new BM(9); 51} 52print(mdf.stageValue);