Virtual 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:
Posts Tagged ‘methods declaration’
Virtual Methods
Sunday, December 8th, 2019Best practices when using methods and functions
Wednesday, April 19th, 2017There are two main reasons why methods and functions are even used. First one, which I already mentioned in a few of the previous posts, is code re-usability. The second is modularization of the code, splitting of complex tasks into smaller sub-tasks, which can offer us a better overview of the entire functionality.… Read more
Methods and functions signature
Monday, April 17th, 2017I talked in the previous lesson about methods and functions signatures, and I offered there a brief explanation on the topic. It is time to explain this new concept in more detail. At a basic level, there are only two things that are mandatory to specify a method or function signature: the parameters type and the order in which the parameters are listed.… Read more
Methods and functions declaration
Sunday, April 9th, 2017Methods and functions declarations is actually a three step process: declaration, implementation, call of our method or function.
- Declaration is the process of writing the method type, name and eventual parameters, so the program can successfully identify it.
- Implementation of a method is writing the actual code that will be executed when the method is executed.