Академический Документы
Профессиональный Документы
Культура Документы
Constructor
- is a special kind of subroutine in a class. It has the same name as the
name of the class and it has no return type, not even void.
- Is called with the new operator in order to create a new object. Its main
purpose is to initialize the newly created object, but in fact, it can do
anything that the programmer wants it to do.
Instance Variables and Instance Methods
- Are non-static variables and methods in a class
- Means that they do not belong to the class itself. Instead, they specify
what variables and methods are in an object that belongs to that class.
- That is, the class contains the source code that defines instance variable
and instance methods, but actual instance variable and instance methods
are contained in objects.
- Instance variables and instance methods are the data and behavior of
objects.
Encapsulation
- Is one of the fundamentals of OOP concepts. The other three are
inheritance, polymorphism and abstraction.
- A mechanism of wrapping the data and code acting on the data together
as a single unit.
- If a data member is private it means it can only be accessed within the
same class. No outside class can access private data member of other
classes.
Super Class and Sub Class
- The original class that is used to derive a new class is called a super class,
parent or base class
- The derived class is a subclass or a child class
Overloading
- If a class has a multiple methods by same name but different parameters,
it is known as method overloading.