Interfaces, just like C/C++ pointers, are one of those topics that beginners, and even intermediate programmers are afraid of, because they do not understand them. In fact, the truth is, they are simple to understand, and the real difficulty comes when asking the question “why should I use them/where should I use them?”.… Read more
Posts Tagged ‘OOP’
Interfaces
Saturday, January 4th, 2020Abstract classes and methods
Saturday, January 4th, 2020As I was explaining in the previous lesson, one way of achieving abstraction is trough the means of abstract classes and methods. The abstract keyword can be used for both classes and methods. An abstract class is a class that provides a partial implementation.… Read more
Abstraction
Friday, January 3rd, 2020Another fundamental principle of Object Oriented Programming is abstraction. Abstraction mainly refers to the ability of using something without knowing or being interested about how that something does what we request of it. We do this every day: we do not care how a computer does all it does (well, actually, some of us do), we only care that it is able to do what we need from it.… Read more
Polymorphism
Friday, January 3rd, 2020The third fundamental principle of Object Oriented Programming is called polymorphism. At a fundamental level, polymorphy refers to the ability of having many forms, or to transform into many forms. It comes from the Greek terms poly, which means “multiple”, and morph, which means “shape” or “form”.… Read more
Encapsulation
Thursday, December 19th, 2019The second fundamental principle of Object Oriented Programming is called encapsulation. Its main definition refers to the action of hiding anything that is not essential from the outside world. It is not very difficult to understand the fact that we do not need to expose everything when we build something.… Read more
Virtual Methods
Sunday, December 8th, 2019Virtual methods are methods that can be overridden in inheriting (derived) classes. By default, in .NET, methods are not virtual. In order to declare a method as virtual, we need to declare it using the keyword virtual, like so:
Inheritance
Sunday, November 17th, 2019In the first lesson of the Objects chapter, I was discussing in a broad way about Object Oriented Programming, acronymed OOP, and I was enumerating it’s fundamental principles: encapsulation, inheritance, abstraction and polymorphism. In this lesson, I will explain inheritance at large, and how class hierarchies improve code readability and reusability.… Read more
Namespaces
Wednesday, August 2nd, 2017In OOP, namespaces are containers for a group of classes which have a common context or are categorized by common functionality. Namespaces do not have any kind of functionality, and it is not mandatory to use them. However, they offer a few advantages, most notably being the ability of sorting and grouping your code into logical units.… Read more
Enumerations
Sunday, July 16th, 2017Structures
Saturday, June 24th, 2017In C# and .NET framework, there are two implementations of the concept of “class”, from the OOP point of view: classes and structures.
While we already know that classes are defined using the class keyword, structures are defined using the keyword struct.… Read more