cool stuffs from OOPS

1) Do private members of the BASE class are derived by the child class?
Ans: Yes they are derived but are not accessible in child class. Public/Private/Protected are used for achieving access level rights.
2) What are the three things that comes to your mind when you think about OOPS?
Ans: Inheritance, Polymorphism, Abstraction/Encapsulation
3) Why C# doesn’t support multiple Inheritance?
Ans: A known problem called “Diamond of Death” will occur if one class will extends multiple classes and the base classes might have derived from a single base class.
But in some other way it seems it is supporting.
i) For example a class can implements multiple Interfaces.
ii) More appropriate example will be an Interface can implement more than one Interface.
4) interfaces do not provide a default implementation
5) What are the ways by which you can make sure that a class can not be inherited by other classes.
Ans: i) make it sealed (C#)
ii) Declare the constructor as private.
6) What are accessor and mutator?
Ans: Accessor and Mutator helps in achieving Encapsulation.An accessor is a method that provide info on object. They are genrally properties which have a get method.On the other side Mutators can modify an object’s state. They are the set method in a properties.

Keep watching this space for some extra innings from OOPS.

Exceptions…Lets Handle it.

It is always advisable to handle EXCEPTIONs properly in your code(provided that the programming language has a support for it). Its a standard practice and the best way to handle surprised or “MY God!!!” type errors .

So you must be aware that its better to be specific while handling errors. Instead of going for a big basket (Exception class in general) choose a specilised exception(for example IOException). Because this will help you not only tracking where the bug is but also reduce debugging time.
Now thats not the point of this topic. When you are very much specific that a particular type of error is going to occur, why don’t you validate instead of going for exception way!!! That may be a more accurate way of not letting the exception to occur. If you know that divide by zero exception is going to occur in your code, then validate the number before hand and pass the non zero arguments so that you will save execution time.

So its completely depends on the requirement, study it properly and go for some validation (as applicable) rather putting more efforts on exception for the same.

Happy Coding…Keep smiling

Happy Mothers’ Day

“What if i will not get a job?” I asked..

“don’t worry..we know you have skills to achieve it, but still if you have a doubt, come back to Bargarh and start your business, start believing yourself. Stay cool” my mother told me.

This statement is about 7 years old, but still it keep boosting me to be confident enough to face the so called struggle of this fast moving world. That day I was bit frustrated and I rightly remember that I called my mother and told the above things. To my surprise she was so cool and replied very softly. That day I realised and started believing myself.

We know ourselves very less as compared to our Mother.

I have seen many ups and downs in life. Though my Mother is not arround me, I can feel her grace and presence in all my activites. I will try to be cool what ever the circumstances may be.

Happy Mothers Day and my regards towards the true spirit of motherhood………..