What Is Synchronization?: Can We Inherit The Constructors?
What Is Synchronization?: Can We Inherit The Constructors?
What is synchronization?
With respect to multithreading, synchronization is the capability to control the access of
multiple threads to shared resources.
Without synchronization, it is possible for one thread to modify a shared object while
another thread is in the process of using or updating that objects value. This often leads to
significant errors.
A constructor is a member function of a class that is used to create objects of that class. It has the same
name as the class itself, has no return type, and is invoked using the new operator.
A method is an ordinary member function of a class. It has its own name, a return type (which may be void),
and is invoked using the dot operator.
Abstract class must be extended/subclassed (to be useful). It serves as a template. A class that is abstract
may not be instantiated (ie. you may not call its constructor), abstract class may contain static data.
Any class with an abstract method is automatically abstract itself, and must be declared as such. A class may
be declared abstract even if it has no abstract methods. This prevents it from being instantiated.
An abstract class can have instance methods that implement a default behavior. An Interface can only
declare constants and instance methods, but cannot implement default behavior and all methods are
implicitly abstract.
An interface has all public members and no implementation. An abstract class is a class which may have the
usual flavors of class members (private, protected, etc.), but has some abstract methods.
Set contain only unique elements while List can contain duplicate elements.
Set is unordered while List is ordered . List maintains the order in which the objects are added .