2
In Javascript I know that it is possible to create an instance of a class using 'new'
new Classe
And how to create an object that is instance of several classes? For example
new Classe, OutraClasse...
I believe this may be possible because it warns true
:
var el = document.createElement('a');
alert(el instanceof HTMLElement && el instanceof HTMLAnchorElement);
Moreover, el
has more than 2 instances...
The text of the question is confused. I believe you want to know if it is possible to create an object that is 2 class instance. Strictly speaking this is possible as long as one class is derived from the other, as is the case with Htmlanchorelement and Htmlelement. But in the general case this is not possible in object-oriented programming, an object is always an instance of a single class.
– zentrunix
@Joséx. Class derived from the other? How could I derive one class from the other?
– Klaider
see reply from @Sergio
– zentrunix