Ooad 2022 Solution

8th Semester

The Factory Pattern is a creational design pattern used in object-oriented programming (OOP) to create objects without specifying the exact class of object that will be created. It provides a way to encapsulate the instantiation logic within a method or class, allowing the client code to use the factory method to create objects without knowing the specific implementation details.

The Singleton Pattern, on the other hand, is a creational design pattern that ensures a class has only one instance and provides a global point of access to that instance.

Here’s how you can implement the Singleton Pattern using an object-oriented programming language:

Q,no 3

 

Class Diagram - Order Process | Class Diagram Template

Q.no 4

unnamed.png

Q,no 5

The Observer Pattern is a behavioral design pattern where an object (known as the subject) maintains a list of its dependents (observers) and notifies them of any state changes, usually by calling one of their methods.

Let’s consider an example of an online newspaper (the subject) and its subscribers (the observers). Whenever a new article is published, the newspaper notifies all its subscribers about the new article so they can read it.

2022 Q.NO 6

Screenshot 2024-09-16 165538

Leave a Reply

Your email address will not be published. Required fields are marked *