Computer Science, asked by avikumar986, 20 days ago

Which of the following statements describe the Open/Closed Principle of the SOLID object-oriented design approach?

1.High-level modules should depend on low-level modules

2.Modifying existing classes should be avoided

3.A class should be open for extension but closed for modification

4.Inheritance should be used to add new features


5.Changes made to existing classes are unlikely to affect the rest of the library

Answers

Answered by KailashHarjo
6

The following statements describe the Open/Closed Principle of the SOLID object-oriented design approach -

2. Modifying existing classes should be avoided

3. A class should be open for extension but closed for modification

4. Inheritance should be used to add new features

  • The open-closed principle, which applies to object-oriented programming, states that classes, modules, functions, etc. should be open for extension but closed for modification; in other words, they should allow for the extension of their behavior without requiring source code changes.
  • If an extension is still possible, an object is said to be open. For instance, it should be possible to add new elements to the set of functions it executes or new fields to the data structures it contains.
  • If an object is accessible to other modules, it is said to be closed. This presupposes that the module has received a clear, consistent description.

For more knowledge on Open- Closed Principle refer to these answers:

https://brainly.in/question/43997352

https://brainly.in/question/48509437

#SPJ2

Similar questions