Object-Oriented Programming (OOP) concept

Ace your homework & exams now with Quizwiz!

what is inheritance?

Ability of a class to extend properties of parent class. Only properties with public and protected can be accessed in child class.

difference between inheritance and polymorphism?

Inheritance defines parent-child relationship between two classes. Polymorphism takes advantage of it and add dynamic behavior. Inheritance - reusability, child class uses parent behavior polymorphism - allow child class to redefine behavior.

does java support multiple inheritance of class?

No. Java allows single inheritance from parent class to child class but implement multiple inheritance through interfaces. Java use extend to express inheritance.

what is polymorphism?

The ability to identify a function to run. Runtime polymorphism: overriding occurs when a subclass method has the same name and signature as its parent and JVM determines which method to use. Compile-time polymorphism: overloading occurs when a class has the same method name but different signatures and diff types of parameters, same signature with different number of parameters, or same signature+parameter types but diff return types.

what is Association?

a relationship where objects have their own lifecycle and there is no owner. objects can be created and deleted independently.

what is Composition?

a special form of aggregation. if parent object is deleted, child objects will be destroyed too. such as house and room relationship.

what is Encapsulation?

a way to combine methods and attributes into a class. A class acts as a container to hold properties. A way to control the access of class data.

what is an abstraction?

a way to provide common feature/behavior of classes or interfaces. A shape abstract class has area method, and subclass such as triangle, rectangle or circle define or implement each individual area.

what is OOPs concept?

inheritance, encapsulation, polymorphism, abstraction

what is Aggregation?

special form of association where all objects have their own lifecycle but there is ownership, and child objects can not belong to another parent object. For example, a teacher can not belong to multiple department but one dept., if delete that department but teacher object will not be destroyed. This is "has-a" relationship.


Related study sets

Econ Exam - Chapter's Assignment Review

View Set

sonnets mastery test edmentum english 12

View Set

CompTIA Security+ 501 (RAID levels)

View Set

IRSC Microeconomics final exam study guide 2023

View Set

Micro Ch. 22: Helicobacter pylori

View Set

CH: 7 Corruption and Ethics in Global Business

View Set