console.log('子类调用,基类构造函数',obj.a,obj.b);
console.log('子类调用:toString()===>',a,b);
class Framework extends Base{
constructor({a=0,b=0}={}) {
let framework = new Framework({a:8,b:9});
console.log('类对象的数据类型:',typeof base,typeof framework,'类的数据类型',typeof Base,typeof Framework);
console.log('类原型对象构造:',Framework.prototype.constructor,'类构造:',Framework.constructor);
console.log('类的原型对象prototype的constructor指向类名:',Framework.prototype.constructor===Framework);
console.log('类名:',Framework.name);
console.log(framework.constructor===Framework.prototype.constructor);
Base.prototype.Add = function (x,y) {
console.log('调用添加到基类原型对象上的方法:',base.Add(1,2));
console.log('派生类调用基类原型对象的方法:',framework.Add(5,6));
Base.prototype.test =()=> {
console.log('test func');
console.log(Object.getOwnPropertyNames(Base.prototype));
Object.assign(Base.prototype, {
console.log(Object.keys(Base.prototype));
Object.assign( Base.prototype,{[method](){
console.log('通过变量名定义的函数');
console.log(Object.keys(Base.prototype));
Reflect.get(base,method)();
console.log(Object.getOwnPropertyNames(Framework.prototype));
console.log('取当前类的继承对象',Object.getPrototypeOf(framework));
console.log('取当前类的继承对象的所有方法',Object.getPrototypeOf( Object.getPrototypeOf(framework)));
let p = Object.getPrototypeOf( Object.getPrototypeOf(framework))
console.log(Object.getOwnPropertyNames(p));
console.log(Reflect.ownKeys(p));
console.log('base对象原型',base.__proto__,'framework对象原型:',framework.__proto__);
const ExpClass = class Exp {
console.log('构造时打印类名:',Exp.name);
console.log('调用getClassName打印类名:');
let exp = new ExpClass();
console.log(exp.getClassName());
let execClass = new class{
let execClassWithParam = new class{
console.log('立即执行类,参数:',param);