“classer” Réponses codées

classer

//class in es6 are just functional constructor.
class PersonES6{
  constructor(firstname,lastname,age){
    this.firstname= firstname;
    this.lastname=lastname;
    this.age=age
  }
  aboutPerson(){
  console.log(`My name is ${this.firstname} ${this.lastname} and I am ${this.age} years old`)
  }
}

const shirshakES6= new Person('Shirshak','Kandel',25)
shirshakES6.aboutPerson();
Shirshak kandel

Classer

uTCFDSWDUTVSAFDVKLJHGBSDICFDSVFCGSFVSFVDVFVADVFVAV
Frightened Flamingo

classer

class Person:
    def __init__(self, name, sex, profession):
        # data members (instance variables)
        self.name = name
        self.sex = sex
        self.profession = profession

    # Behavior (instance methods)
    def show(self):
        print('Name:', self.name, 'Sex:', self.sex, 'Profession:', self.profession)

    # Behavior (instance methods)
    def work(self):
        print(self.name, 'working as a', self.profession)
Beast

classer

# class
class Enum:
    Tim, Bill, Joe = range(1,4)
print(Enum.Tim == 1)			# return True
Impossible Impala

Réponses similaires à “classer”

Questions similaires à “classer”

Plus de réponses similaires à “classer” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code