Hey, I'd like to define a class depending on a boolean
Theres two implementation of the same object "Object", implementation A and implementation B.
If boolean is true, Object is defined as implementation A, otherwise it is defined as implementation B
Example of a working python code
class Hello:
def __init__(self):
self.greeting = "Hello!"
class Salut:
def __init__(self):
self.greeting = "Salut!"
if my_switch:
Hello = Salut
# Pseudo code equivalent:
if my_switch:
class Hello:
def __init__(self):
self.greeting = "Hello!"
else:
class Hello:
def __init__(self):
self.greeting = "Salut!"
In java, implementation A is public class RegionFile extends Thread, B is public class RegionFile implements AutoCloseable, and the implementation is very different.
I cannot change the code of the project according to this single declaration, so i'd like to change this class according to a boolean.
How can i do that ?