You already know from the lesson methods and functions and parameters that you can create methods that accept a number of parameters of different types. But what if you would want to send a method itself as a parameter to another method?… Read more
Posts Tagged ‘class’
Delegates
Thursday, January 9th, 2020Inheritance
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
Other Data Structures
Saturday, June 16th, 2018Surprisingly, you will notice that we have already used these data structures before, without knowing they were data structures: the class and the structure. Whenever we instantiate one of these, we are actually using it as a data structure (more or less).… 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
Generic classes
Sunday, June 18th, 2017Generic classes, also known as generic data types or simply generics, are classes of unknown type until they are instantiated to some specific type.
Because this concept is a bit harder to explain, I will first exemplify a specific case that will help you better understand it.… Read more
Nested classes
Friday, June 9th, 2017C# offers nested classes, which just like all the other nested programming concepts, implies a construct (class) defined inside the body of another construct (class). The class defined this way is called “inner class”, while the one which contains it, is called “outer class”.… Read more
Instantiation
Wednesday, April 26th, 2017I have explained a few times already that when we are dealing with objects, most of the times we are not working with the original class itself – the blueprint, but we are actually create copies of it called instances.… Read more
Constructors
Tuesday, April 25th, 2017In object-oriented programming, when creating objects from given classes, it is sometimes necessary to call some special methods of those classes, known as a constructors.
Constructor of a class is a pseudo-method, which does not have a return type, has the name of the class and is called using the keyword new.… Read more
Classes
Saturday, April 22nd, 2017At a definition level, classes are objects defined by the keyword class, followed by an identifier (name) and a body (code block), which contains the codes that define the object and its behavior.
Most of the times, classes can contain only four kind of elements:
- Fields – member variables of a certain type, defined at class level
- Properties – a special kind of programming constructs which helps us manipulate the fields, and set the properties of the object
- Methods – they implement the functionality of the object.