COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
A term that is used to describe the relationship between classes that have their own lifecycle, there is no ownership and they exist independently of each other
A
Association
B
Aggregation
C
Composition
D
Polymorphic
Explanation: 

Detailed explanation-1: -An association is a “using” relationship between two or more objects in which the objects have their own lifetime and there is no owner.

Detailed explanation-2: -Composition: Composition is a “part-of” relationship. Simply composition means mean use of instance variables that are references to other objects. In composition relationship both entities are interdependent of each other for example “engine is part of car”, “heart is part of body”.

Detailed explanation-3: -Association in Java defines the connection between two classes that are set up through their objects. Association manages one-to-one, one-to-many, and many-to-many relationships. In Java, the multiplicity between objects is defined by the Association.

Detailed explanation-4: -An association class is identical to other classes and can contain operations, attributes, as well as other associations. For example, a class called Student represents a student and has an association with a class called Course, which represents an educational course. The Student class can enroll in a course.

Detailed explanation-5: -An IS-A relationship is inheritance. The classes which inherit are known as sub classes or child classes. On the other hand, HAS-A relationship is composition. In OOP, IS-A relationship is completely inheritance.

There is 1 question to complete.