Object Oriented Programming

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Destructor

A destructor is a method which is automatically invoked when the object is destroyed. Its main purpose is to free the resources (memory allocations, open files or sockets, database connections, resource locks, etc.)

What is a class?

A set or category of things having some property or attribute in common and differentiated from others by kind, type, or quality... A blueprint for an object.

Method override vs Method Overload

In Overriding methods it will create two or more methods with same name and same parameter in different classes. while Overloading it will create more then one method with same name but different parameter in same class.

Interface

In its most common form, an ________ is a group of related methods with empty bodies. They are a reference type, similar to a class, that can contain only constants, method signatures, default methods, static methods, and nested types. Method bodies exist only for default methods and static methods. ________s cannot be instantiated—they can only be implemented by classes or extended by other _________s

Inheritance

In object-oriented programming, _______ enables new objects to take on the properties of existing objects. A class that is used as the basis for ________ is called a superclass or base class. A class that inherits from a superclass is called a subclass or derived class.

Polymorphism

In object-oriented programming, _______ refers to a programming language's ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes. .... _______ means that an object (i.e. Animal) can take on several forms while your program is running.

What is operator overloading?

In programming, operator overloading—less commonly known as operator ad hoc polymorphism—is a specific case of polymorphism, where different operators have different implementations depending on their arguments. Operator overloading is generally defined by the language, the programmer, or both. (e.g. += and *= in java)

What is OOP?

Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data.

this keyword

With this, you explicitly refer to the object instance where you are. You can only do it in instance methods or initializer blocks, but you cannot do this in static methods or class initializer blocks. When you need this? Only in cases when a same-named variable (local variable or method parameter) is hiding the declaration. For example: private int bar; public void setBar(int bar) { this.bar = bar; } Here the method parameter is hiding the instance property. When coders used to use it? To improve readability, it is a common practice that the programmers prepend the this. qualifier before accessing an instance property. E.g.: public int getBar() { return this.bar; // return bar; // <-- this is correct, too }

abstract class

a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.

Package

a namespace that organizes a set of related classes and interfaces. Conceptually you can think of _______s as being similar to different folders on your computer.

Object

all ______ have state and behavior. A _______ stores its state in fields (variables in some programming languages) and exposes its behavior through methods (functions in some programming languages)

Encapsulation

an Object Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. ________ led to the important OOP concept of data hiding.

Access Modifier

determine whether other classes can use a particular field or invoke a particular method. There are two levels of access control: At the top level—public, or package-private (no explicit modifier) and at the member level—public, private, protected, or package-private (no explicit modifier).

Private

visible only within the class

no modifier

visible to class and subclass

Protected

visible to class, subclass, and package

Public

visible to class, subclass, package, and world


संबंधित स्टडी सेट्स

microcomputer applications final exam

View Set

Chapter 10: assessment of high risk pregnancy

View Set

Chapter 10 - Legally Required Benefits

View Set

PSY 211 Exam 3: Learning and Memory

View Set

Pharmacology HESI Comprehensive Review

View Set