#24 Inheritance, Super Keyword, Polymorphism with example | Python Tutorial Series | EMC Academy

Поделиться
HTML-код
  • Опубликовано: 4 дек 2024

Комментарии • 38

  • @smiley_boy_arjun_08
    @smiley_boy_arjun_08 7 месяцев назад +5

    Q3
    class vehicle():
    def start(self):
    print ("vehicle Start")
    class car(vehicle):
    def start(self):
    print ("car is started ")
    Swift=car()
    Swift.start()
    Output
    car is started

  • @gayathribaskaran6530
    @gayathribaskaran6530 Год назад +20

    Class Employee();
    def__init__(self,name, salary);
    Self.name =name
    Self.salary= salary
    Class Manager (Employee);
    def__init__(Self,name,salary, department);
    Super().__init__(name,salary)
    Self.department=department
    def display (Self);
    Print("Self.name,Self.salary, self.department)
    M1= Manager(" John","50000","CSE")
    M1.display()

    • @deepasekar9382
      @deepasekar9382 9 месяцев назад +3

      case sensitive,neenga ellam caps la kuduthurukeenga,keywords also
      class employee():
      def __init__(self,name,salary):
      self.name=name
      self.salary=salary

      class manager(employee):
      def __init__(self,name,salary,department):
      super().__init__(name,salary)
      self.department=department
      def display(self):
      print(self.name,self.salary,self.department)
      ob=manager("deepa","120000","IT")
      ob.display()
      this is crt ans

    • @kabilandina11
      @kabilandina11 8 месяцев назад +1

      🎉

  • @anandh__0752
    @anandh__0752 2 месяца назад +2

    Task completed ✅

  • @I_am_groot...
    @I_am_groot... Год назад +1

    For 3rd question
    class vehicle ():
    def start(self):
    print("vehicle started")
    class car(vehicle):
    def start(self):
    print("car started")
    a1 = car()
    a1 . start()
    RESULT :
    car started

  • @c007-v8j
    @c007-v8j Год назад +2

    class Shape:
    def area(self):
    return 0
    class Rectangle(Shape):
    def area(self,length,breadth):
    self.l=length
    self.b=breadth
    print(f"The lenght {self.l} and breadth {self.b} and the total {self.l*self.b}")
    obj_01=Rectangle()
    obj_01.area(12,13)

  • @arunworld1607
    @arunworld1607 Год назад +2

    class employee():
    def __init__(self,name,salary):
    self.name=name
    self.salary=salary

    class manager(employee):
    def __init__(self,name,salary,dept):
    super().__init__(name,salary)
    self.dept=dept

    def display(self):
    print("Name:",self.name,"Salary:", self.salary,"Dept:",self.dept)

    m=manager("Arun","10000","Admin")
    m.display()
    output:
    Name: Arun Salary: 10000 Dept: Admin

  • @bhuveneshwarparamjothy501
    @bhuveneshwarparamjothy501 9 месяцев назад +1

    class employee():
    def __init__(self,name,salary):
    self.name=name
    self.salary=salary
    class manager(employee):
    def __init__(self,name,salary,department):
    super().__init__(name,salary)
    self.department=department

    def display(self):
    print(self.name,self.salary,self.department)
    m1=manager("Bhuven", "RM15000" , "IT")
    m1.display()

  • @subashsmiles5447
    @subashsmiles5447 7 месяцев назад

    class vehicle():
    def start(self):
    print("Vehicle Started")
    class car(vehicle):
    def start(self):
    print("Car started")
    suzuki=car()
    suzuki.start()

  • @shanmugapriyanr9049
    @shanmugapriyanr9049 Год назад +4

    Super() keyword ah vachi constructor matum tha inherit panni use panna mudiyum ah ila yantha function nalum use pannikalam ah

    • @JK-de2gh
      @JK-de2gh 9 месяцев назад +1

      entha parent class ahh vena inherit panala bro

  • @saimanasab7386
    @saimanasab7386 5 месяцев назад +3

    QN 4 with the help of user input:
    class employee():
    def __init__(self,nam,salar):
    self.name=nam
    self.salary=salar
    class manager(employee):
    def __init__(self,depart):
    self.department=depart
    super(). __init__ (nam,salar)
    def display(self):
    print(self.name,self.salary,self.department)
    nam=input("Enter your name:")
    salar=int(input("Your salary:"))
    depart=input("Which department you are from?")
    obj1=employee(nam,salar)
    obj=manager(depart)
    obj.display()

  • @nvsbflims4624
    @nvsbflims4624 6 месяцев назад +2

    Sir 4th question is this correct sir
    class Employee():
    def __init__(self,name,salary):
    self.name = name
    self.salary =salary
    class Manager(Employee):
    def __init__(self,name,salary,dept):
    self.dept = dept
    super().__init__(name,salary)
    def display(self):
    print("Name :",self.name)
    print("Salary :",self.salary)
    print("Department :",self.dept)
    m1 = Manager("Nandha",100000,"FSWD")
    m1.display()

  • @prakashgunasekaran1408
    @prakashgunasekaran1408 10 месяцев назад +1

    Hi Bro, could you please cover Regular expressions also ?

  • @saimanasab7386
    @saimanasab7386 5 месяцев назад

    QN 2: (USER INPUT)
    class person():
    def __init__(self,name):
    self.name=name
    class student(person):
    def __init__(self,name,grade):
    super(). __init__ (name)
    self.grade=grade
    def display(self):
    print(self.name,self.grade)
    name=input("Enter your name:")
    grade=float(input("Enter your grade:"))
    obj=student(name,grade)
    obj.display()

  • @nisha__08
    @nisha__08 Год назад +1

    Last question super keyword use panaamale output varudhu
    Apdi pana kudadha bro

  • @nisha__08
    @nisha__08 Год назад +1

    16.02 name ah student class la store panalam la bro ( self.name= name)
    Bcz inherit panirukom la Apdi save pana output varudhu.
    Apdi pana kudadha?

    • @JK-de2gh
      @JK-de2gh 9 месяцев назад +1

      panlam vro naa apdithan panen....

  • @KavithaSundharam
    @KavithaSundharam Год назад +1

    Bro,
    Self.name="success"
    Self.salary="30000"
    Entha mathiri variable use panna mudiyuma

  • @Sivanithi_S
    @Sivanithi_S Год назад +1

    Give more examples...

  • @nvsbflims4624
    @nvsbflims4624 6 месяцев назад

    Bro 3rd question ans is correct or not please tell bro
    class Vehicle():
    def start(self):
    print("Vehicle Started...")
    class Car(Vehicle):
    def start(self):
    print("Car Started...")
    c1 = Car()
    c1.start()

  • @KavithaSundharam
    @KavithaSundharam Год назад

    Class employee:
    def__init__(self,name,salary):
    Self.name="success"
    Self.salary="20000"
    Class manager (employee):.
    def__init__(self,name, salary,
    department):
    super ().__init__(name,
    salary)
    self department="CSE"
    def display(self):
    print(self.name,self.salary,
    self. department)
    M1=manager()
    M1.display()
    ERROR:
    TYPE ERROR: manager.__init__() missing 3 required positional arguments:"name","salary","department"
    Entha program enna mistake nu sollunka bro

    • @premkumarms7607
      @premkumarms7607 Год назад

      class employee:
      def __init__(self, name, salary):
      self.name = "success"
      self.salary = "20000"
      class manager(employee):
      def __init__(self, name, salary, department):
      super().__init__(name, salary)
      self.department = "CSE"
      def display(self):
      print(self.name, self.salary, self. department)
      M1 = manager("Prem","20","CSE")
      M1.display()

    • @KavithaSundharam
      @KavithaSundharam Год назад

      @@premkumarms7607
      but bro, we already declare the name and salary value
      self.name,self salary,
      then why we set value M1=manager name, salary, department

    • @gayathribaskaran6530
      @gayathribaskaran6530 Год назад

      Class Employee();
      def__init__(self,name, salary);
      Self.name =name
      Self.salary= salary
      Class Manager (Employee);
      def__init__(Self,name,salary, department);
      Super().__init__(name,salary)
      Self.department=department
      def display (Self);
      Print("Self.name,Self.salary, self.department)
      M1= Manager(" John","50000","CSE")
      M1.display()

  • @UNIQUEFASHION-mr9wl
    @UNIQUEFASHION-mr9wl Год назад

    last prgm anwer thrla bro?
    any on know the ans pls tell meee

    • @gayathribaskaran6530
      @gayathribaskaran6530 Год назад +1

      Class Employee();
      def__init__(self,name, salary);
      Self.name =name
      Self.salary= salary
      Class Manager (Employee);
      def__init__(Self,name,salary, department);
      Super().__init__(name,salary)
      Self.department=department
      def display (Self);
      Print("Self.name,Self.salary, self.department)
      M1= Manager(" John","50000","CSE")
      M1.display()

    • @UNIQUEFASHION-mr9wl
      @UNIQUEFASHION-mr9wl Год назад

      @@gayathribaskaran6530 tq❤

  • @Dante11158
    @Dante11158 5 месяцев назад

    class employee():
    def __init__(self,name,salary):
    self.name=name
    self.salary=salary
    class manager(employee):
    def __init__(self,name,salary,department):
    super().__init__(name,salary)
    self.department=department
    def display(self):
    print(self.name)
    print(self.salary)
    print(self.department)
    m1=manager("ERAI","20000","SUPPORT")
    m1.display()

  • @arunhhh333
    @arunhhh333 Год назад

    class employee():
    def __init__(self,name,salary):
    self.name=name
    self.salary=salary
    class manager(employee):
    def __init__(self,name,salary,department):
    super().__init__(name,salary)
    self.department=department
    def display(self):
    print("The name of the employee is {} The salary of the employee is {} And the employee department is {}".format(self.name,self.salary,self.department))

    m1=manager("Arun",9000,"I.T")
    m1.display()

  • @Mano_2517
    @Mano_2517 Год назад

    class employee():
    def __init__(self,name,salary) -> None:
    self.name=name
    self.salary=salary

    class manager(employee):

    def __init__(self, name, salary, dept) -> None:
    super().__init__(name, salary)
    self.dept=dept

    def display(self):
    print(self.name,self.salary, self.dept)

    boj=manager("xyz", 1345645, "CS")
    boj.display()

  • @JrJs-cg7gu
    @JrJs-cg7gu Год назад +9

    Vara Vara sollikodukathu puriya mattika

    • @anandh__0752
      @anandh__0752 2 месяца назад +1

      Ila bro first time enakum apdi tah irunchi but video va extra oru time pathu tu try Pannu bro

  • @subashsmiles5447
    @subashsmiles5447 7 месяцев назад

    class employee():
    def __init__(self, name, salary):
    self.name = name
    self.salary = salary
    class manager(employee):
    def __init__(self,name,salary,department):
    self.department=department
    super().__init__(name,salary)
    def display(self):
    print(self.name, self.salary,self.department)
    m1=manager("Ronit", "20000", "Ops")
    m1.display()

  • @SathishR-x6h
    @SathishR-x6h 4 месяца назад

    class employee():
    def __init__(self,name, salary):
    self.name=name
    self.salary=salary
    class manager (employee):
    def __init__(self,name,salary, department ):
    self.department=department
    super ().__init__(name, salary)
    def display (self):
    print(self.name,self.salary,self.department)
    m1=manager ("john","5k","cse")
    m1.display()