Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have written the code to Abstract Base class, How can i access the child class method (enviorment_trees) using another class? Is it possible?

from abc import ABCMeta, abstractmethod


class EnvironmentAsset(object):
__metaclass__ = ABCMeta

@abstractmethod
def __init__(self):
print("method1")



class Trap(EnvironmentAsset):
def __init__(self):
super(Trap, self).__init__()

@abstractmethod
def enviorment_trees(age):
print("age",age);
return
Posted
Updated 23-Feb-15 22:15pm
v2
Comments
Rahul VB 21-Mar-19 7:30am    
Can you please elaborate further? Do you mean the below:
1. You have a class which inherits a method from an abstract class.
2. Now, you want to call that method from a different class...

Is my understanding correct?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900