Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Classe wrapper en python

def decorator(cls): 
      
    class Wrapper: 
          
        def __init__(self, x): 
              
            self.wrap = cls(x) 
              
        def get_name(self): 
              
            
            return self.wrap.name 
          
    return Wrapper 
  
@decorator
class C: 
    def __init__(self, y): 
        self.name = y 
  
x = C("Geeks") 
print(x.get_name())
Source by fr.acervolima.com #
 
PREVIOUS NEXT
Tagged: #Classe #wrapper #en #python
ADD COMMENT
Topic
Name
9+8 =