Home >>Python Built-in Functions >Python issubclass() Function
Python issubclass() function is used to return True value if the given input object is a subclass of the specified object otherwise it will return False value.
Syntax:issubclass(object, subclass)
Parameter | Description |
---|---|
object | This is a required parameter. It defines the given object. |
subclass | This parameter defines a class object or a tuple of class objects. |
class myAge:
age = 21
class myObj(myAge):
name = "Jerry"
age = myAge
x = issubclass(myObj, myAge)
print(x)
class myAge:
age = 21
class myJob:
job = "Developer"
class myObj(myAge):
name = "Jerry"
age = myAge
x = issubclass(myObj, myJob)
print(x)