Posts

Showing posts from January, 2016

What is SOLID Principle in OOPS

  Single Responsibility Principle states that every object should only have one reason to change, i.e. every object should perform one thing only. Open-Closed Principle states that classes should be open for extension and closed for modification. Liskov Substitution Principle states that you should be able to use a derived class in place of a parent class and it must behave in the same manner.   Interface Segregation Principle states that clients should not be forced to depend on interfaces they  do not use. Dependency Inversion Principle helps to decouple your code by ensuring that you depend on abstractions rather than concrete implementations.

Difference Between Singleton and Static class?

Singleton :  1. Singleton class contains both static and non-static members  2. You can create instance of Singleton class.  3. You can implement inheritance.  4. You can clone a singleton class object.  5. Singleton class object creates in Heap memory.   Static Class:     1. Static class contains only static members.   2. You can't create instance of Static class.   3. Once you declare a class as static you can't implement inheritance.   4. You can't clone static class object.   5. Static class object creates in stack memory.