What are classes?
What are objects?
What are constructors?
How is a class set up called ItemForSale with 3 attributes: itemName, price, discount
class ItemForSale():
def __init__ (self, itemName, price, discount):
self.__itemName = itemName
self.__price = price
self.__discount = discount
How to add a new object to a class ItemForSale with 3 attributes
tank = ItemForSale(“tank”, 10, 10)
what is a method and what are the 2 different types?
Describe a public method
Describe a private method
What is an attribute?
What is inheritence?
What is encapsulation?
What is abstraction in encapsulation?
What is polymorphism?
What are get and set methods?
How would you code a get method for an ItemForSale?
class ItemForSale():
def __init__(self, itemName, price, discount):
self.__itemName = itemName
self.__price = price
self.__discount = discount
def getPrice(self):
return self.\_\_pricetank.getPrice()
What keyword is used for inheritance?
How would you code inheritance for an ItemForSale?
class tank(ItemForSale):
def __init__(self, itemName, price, discount, quantity):
super().__init__(itemName, price, discount)
self.__quantity = quantity
What is encapsulation in terms of get methods?
How would you code encapsulation for an ItemForSale?
class ItemForSale():
def __init__(self, itemName):
self.__itemName = itemName
def getItemName(self):
return self.\_\_itemNameWhat is encapsulation in terms of set methods?
What is run-time polymorphism?