Last active
June 15, 2021 10:23
-
-
Save metametaclass/b7770986535a049c79d5ee2379d3d819 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DHCP: | |
def dhcp_test(self): | |
self.executor.exec_command("dhcp test") | |
class Client(DHCP): | |
def __init__(self, executor): | |
self.executor = executor | |
class Executor: | |
def exec_command(self, cmd): | |
print(cmd) | |
class Executor2: | |
def exec_command(self, cmd): | |
print("begin exec") | |
print(cmd) | |
print("end exec") | |
client = Client(Executor()) | |
client.dhcp_test(); | |
client2 = Client(Executor2()) | |
client2.dhcp_test(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DHCP: | |
def dhcp_test(self): | |
self.exec_command("dhcp test") | |
class Executor: | |
def exec_command(self, cmd): | |
print(cmd) | |
class Client(Executor, DHCP): | |
pass | |
class Executor2: | |
def exec_command(self, cmd): | |
print("begin exec") | |
print(cmd) | |
print("end exec") | |
class Client(Executor, DHCP): | |
pass | |
class Client2(Executor2, DHCP): | |
pass | |
client = Client() | |
client.dhcp_test(); | |
client2 = Client2() | |
client2.dhcp_test(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment