JSFiddle - React, Tailwind, and code Playground
JavaScript
function class_1()
{
this.A_1;
this.B_1;
}
class_1.prototype.func_class_1 = function()
{
alert('asd');
/*
здесь идет работа с this.A_1, this.B_1
*/
}
function class_2 (_obj /*object of type class_1*/)
{
this.A_2;
this.B_2;
this.Obj_2 = _obj;
}
class_2.prototype.func_class_2 = function()
{
//вот здесь и происходит проблема с вызовом "func_class_1()"
this.Obj_2.func_class_1();
}
var o1 = new class_1();
var o2 = new class_2(o1);
o2.func_class_2(); //сообщение исп. среды>>> Uncaught Error: Field or method "func_class_1()" does not already exist, and can't create it on undefined