Posts

Showing posts from November, 2021

OOPS in python

 Varaiable types inside class: here  and here Two types of variables: Class or staic variables Instance variables  Types of methods inside class: here 3 types of methods: Class methods Instance methods  Static methods --------------- import and __main__ ( here ) ------------------ class or static variables: If we want to change class or static variable, it will be changed for that specific instance or object of calss If we want to upadte class varaible only for specific instance,we will do so as shown in below example or else if we  want to update class variable across all objects we need to use class method Example: class HelloWorld:     name="bmaddi"    obj=HelloWorld() print(obj.name)  //bmaddi obj.name="chand" print(obj.name) .//chand print(HelloWorld.name) //bmaddi obj2=HelloWorld() print(obj2.name) //bmaddi --------------------------------------------------------- Class Method:(Best video ) If we want to update class variables we u...