Thursday, August 21, 2014

Abstract in C#

In this article, we'll look at what abstract in C# is. Also we'll look at 
when and how you can use it to get its benefits.


In C# abstract modifier indicates that the thing being modified has a missing or incomplete implementation. This modifier can be used with classes, methods, properties, indexers and events. 

Abstract classes can contain both abstract and non-abstract members. Abstract member cannot exist outside an abstract class. You can instantiate abstract class by making a concrete class deriving from it (An instance of a derived class is also a instance of its base class). 

Also you can't create abstract constructor because abstract means you must override it in any non-abstract child class. But you can have non-abstract constructors. You can't override a constructor. You can't create sealed abstract classes. 

You cannot have non-abstract method signature inside abstract class. For non-abstract methods you must provide implementation (link). You cannot have private virtual or abstract members inside a abstract class. But You can have non-abstract private methods inside abstract classes.



Saturday, August 2, 2014

Execution Context Best Practices in JavaScript


In this article we'll see what this means, and places where this is applicable. 
We'll also look at how to manipulate this with built-in functions like 
apply, call and bind.

Every JavaScript statement is executed in one execution context or the other. In it's simplest terms this refers to the "owner"  of  the function we currently executing. this helps us to get the object or the execution context we are currently working with.

In the above example both func1 and func2 returns this. because f1 was called (executed) inside the window (or global context) func1 returns window. In f2 we are using strict mode. In strict mode, this will be whatever it's set to when entering the execution context. Since we have not defined this, it will remain undefined. We can set that to any value we want. Even null. 
Powered by Blogger.


Software Architect at Surge Global/ Certified Scrum Master

Experienced in Product Design, Software Engineering, Team management and Practicing Agile methodologies.

Search This Blog

Facebook