Early Binding
Early Binding And Late Binding.......
if the base class object wants to call the function of derived class ,it will get the reference of base class function at run time since there is association between base class to derived class at compile time. this is late binding..
(
class A{}
class B:A{}
class c:b{}
)
In the above program child class has already known the reference of parent class like we can say that when child has the reference of any parent class then it is earlier known to that child to which class it is derived...
So, Here is Early binding
But Any parent class don't have the reference of any child we have to give it explicitly by some process or mechanism (virtual and abstract keyword) and at run time parent class will take the reference of his child class because pointer mechanism starts at run time not compile-time....
..............................................Topic Starts here.................................................
Early and Late Biding
.........................
if the type of object is deterministic means type of object(class name) is confirm before creation of object and this object allocates memory by new keyword. we can say this object is early bound with confirm type.
If there is a class name employee. we create the object of this class as................
employee ravi=new employee();
here one thing is clear that ravi is of type employee; so we can say ravi is early bounded. we can not assign any other object type to ravi object...
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''.
if the type of object is no-deterministic means type of object is not known before execution of program. the type of object points to a particular class at run time. This process is called late binding since the object takes decision to which class it have to point is determined late(run time).
an object is late bounded when it is assigned to a variable declared to be of type Object. Objects of this type can hold references to any object.
................................................................
if the dll is loaded at compile time by syntax :>csc /t:library prg.cs ,the dll is early bounded to program......
if the dll is loaded at run time by the use of reflection , this is late binding;
Derived class has the the reference of the base class before creation of object of derived class. means derived class is early bounded to base class. so the derived class object can determine at compile time which function has to be called of base class or derived class..
we should use early-bound objects whenever possible, because they allow the compiler to make important optimizations that yield more efficient applications. Early-bound objects are significantly faster than late-bound objects and make your code easier to read and maintain by stating exactly what kind of objects are being used. Another advantage to early binding is that it enables useful features such as automatic code completion. Early binding also reduces the number of run time errors.
if the base class object wants to call the function of derived class ,it will get the reference of base class function at run time since there is association between base class to derived class at compile time. this is late binding..
(
class A{}
class B:A{}
class c:b{}
)
In the above program child class has already known the reference of parent class like we can say that when child has the reference of any parent class then it is earlier known to that child to which class it is derived...
So, Here is Early binding
But Any parent class don't have the reference of any child we have to give it explicitly by some process or mechanism (virtual and abstract keyword) and at run time parent class will take the reference of his child class because pointer mechanism starts at run time not compile-time....
..............................................Topic Starts here.................................................
Early and Late Biding
.........................
if the type of object is deterministic means type of object(class name) is confirm before creation of object and this object allocates memory by new keyword. we can say this object is early bound with confirm type.
If there is a class name employee. we create the object of this class as................
employee ravi=new employee();
here one thing is clear that ravi is of type employee; so we can say ravi is early bounded. we can not assign any other object type to ravi object...
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''.
if the type of object is no-deterministic means type of object is not known before execution of program. the type of object points to a particular class at run time. This process is called late binding since the object takes decision to which class it have to point is determined late(run time).
an object is late bounded when it is assigned to a variable declared to be of type Object. Objects of this type can hold references to any object.
................................................................
if the dll is loaded at compile time by syntax :>csc /t:library prg.cs ,the dll is early bounded to program......
if the dll is loaded at run time by the use of reflection , this is late binding;
Derived class has the the reference of the base class before creation of object of derived class. means derived class is early bounded to base class. so the derived class object can determine at compile time which function has to be called of base class or derived class..
we should use early-bound objects whenever possible, because they allow the compiler to make important optimizations that yield more efficient applications. Early-bound objects are significantly faster than late-bound objects and make your code easier to read and maintain by stating exactly what kind of objects are being used. Another advantage to early binding is that it enables useful features such as automatic code completion. Early binding also reduces the number of run time errors.
Comments
Post a Comment