CLICK 12-A Q1
name
also called identifier, the name given to objects when creating objects
display()
an instance method in python
methods
are functions that are defined inside a class that describe the behaviors of an object. used by programmers for reusability/keeping functionality encapsulated inside one object at a time
attributes
belong to the class itself, defined in the class template and represent the state of an object.
attributes and behavior
characteristics of an object
__repr__
a specific method that returns the object representation in string format
dot notation
A form of syntax used to access the properties or call the methods of an instance
enclosing namespace
A function or a block of code defined inside any function can access the namespace of the outer function or block of code.
yes
Are attributes always public and can be accessed thru dot notation?
four types of namespaces
Built-in Global Enclosing Local
YES
Can we access all the names defined in the built-in namespace as follows? (t/f)
global namespace
Defined at the program/module level. It contains the name of objects defined in a module/main program, created when the program starts and exists until the program is terminated by the python interpreter.
WE CAN
In Python, can we declare variable names and assign them to the objects? (t/f)
inheritance
a way of creating a new class for using details of an existing class without modifying it.
WRONG
The variable names can be accessed outside the block of code or the function in which they are defined, if in a local namespace. (t/f)
namespace
a collection of names, symbolic names along with the information about the object that each name references can be understood as a dictionary where a name represents a key and objects are values.
class (python)
a collection of objects, contains the blueprints or the prototype from which the objects are being created. It is a logical entity that contains some attributes and methods. used to create user-defined data structures.
special method
a defined function that starts and ends with two underscores and is invoked automatically when certain conditions are met.
object-oriented programming
a programming paradigm that uses objects and classes in programming. It aims to implement real-world entities like inheritance, polymorphisms, encapsulation, etc. in the programming.
__init__
a special method, also known as CONSTRUCTOR, is used to initialize the class
built-in namespace
contains the names of built-in functions and objects. It is created while starting the python interpreter, exists as long as the interpreter runs, and is destroyed when we close the interpreter.
instantiation
creating a copy of a class which inherits all class variables and methods
local namespace
defined for a class, a function, a loop, or any block of code. The names defined in a block of code or a function are local to it.
morphism
forms (Greek)
Name (which means name, a unique identifier) + Space (related to scope)
formula of namespace
object
instances of a class created with specifically defined data.
keyword Class
keyword used to define a new class
poly
many (Greek)
getter method
methods which help access the private attributes or get the value of the private attributes
setter method
methods which help change or set the value of private attributes.
= 11120
myInt
= "PythonProgram"
myString
derived class
other name for child class, the class that inherits all the data members, properties, and functions of the parent class.
base class
other name for parent class, the class where the attributes/methods are inherited
term self
placed in the attributes, refers to the corresponding instances
encapsulation
restricts access to methods and variables and prevents data from direct modification
polymorphism
the ability of an object to take many forms
main concepts of OOPs
to bind the data and the functions that work on that together as a single unit so that no other part of the code can access this data.
double underscores
used to denote private attributes as prefix
class
user-defined data types that act as the blueprint for individual objects, attributes and methods