Type Here to Get Search Results !

What does the "single responsibility principle" state?

0

 What does the "single responsibility principle" state?

A) A class should have multiple responsibilities.
B) A class should have one reason to change.
C) A class can have only one instance.
D) A class should only be abstract.

Answer: B) A class should have one reason to change.

Explanation: The single responsibility principle (SRP) is one of the SOLID principles of object-oriented design. It states that a class should have only one reason to change, meaning it should have one responsibility or purpose. This leads to more maintainable and understandable code.

Post a Comment

0 Comments