xxxxxxxxxx
>>> class test(object):pass
>>> issubclass(test,object)
True
xxxxxxxxxx
const div = document.querySelector('div');
div.classList.contains('secondary'); // trueCode language: JavaScript (javascript)
xxxxxxxxxx
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
class Student(Person):
def __init__(self, name, age, school):
super().__init__(name, age)
self.school = school
#Check whethe a class is a subclass of another
print(issubclass(Student, Person))
xxxxxxxxxx
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
class Student(Person):
def __init__(self, name, age, school):
super().__init__(name, age)
self.school = school
#Check whethe a class is a subclass of another
print(issubclass(Student, Person))