Turkey and the Balkans TV Channels

News about 100+ TV channels

Difference between static class and singleton pattern

  • Singleton object stores in Heap but, static object stores in stack
  • We can clone the object of Singleton but, we can not clone the static class object
  • Unlike static classes, we can use singletons as parameters or objects.
  • we can implement interface with Singleton class but not with Static class.
  • Singleton class follow the OOP(object oriented principles) but not static class
  • Singleton class maintains state. It is thread safe.
  • we can dispose the objects of a singleton class but not of static class

The difference between the Singleton and Static is Singleton Class can have value when Class object instantiated between server and client, such a way if three client want to have a shared data between them Singleton can be used. Static are always just shared and have no instance but multiple references.

What is difference between abstract class and an interface



Abstract class

Multiple inheritance

A class may inherit several interfaces.

A class may inherit only one abstract class.

Default implementation

An interface cannot provide any code, just the signature.

An abstract class can provide complete, default code and/or just the details that have to be overridden.

Access Modfiers An interface cannot have access modifiers for the subs, functions, properties etc everything is assumed as public An abstract class can contain access modifiers for the subs, functions, properties

Core VS Peripheral

Interfaces are used to define the peripheral abilities of a class. In other words both Human and Vehicle can inherit from a IMovable interface.

An abstract class defines the core identity of a class and there it is used for objects of the same type.


If various implementations only share method signatures then it is better to use Interfaces.

If various implementations are of the same kind and use common behaviour or status then abstract class is better to use.


Requires more time to find the actual method in the corresponding classes.


Adding functionality (Versioning)

If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method.

If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly.

Fields and Constants No fields can be defined in interfaces An abstract class can have fields and constrants defined

Cheap MLB Jerseys maillot de foot pas cher www.fotballdrakter.org