C Sharp Encapsulation

C# Encapsulation The concept of wrapping data (data members and member functions) into a single unit called class, to prevent alteration of data from outside is called encapsulation in C#. To access or read such data in a fully encapsulated class, the getter functions of the class are used and the setter functions are used … Read more

Categories C#

C Sharp Access Modifiers / Specifiers

C# Access Modifiers / Specifiers The keywords used in a C# application to specify the accessibility or scope of variables and functions are called C# Access modifiers or specifiers. There are five types of access specifiers in C#. These are: Public Protected Internal Protected internal Private Any of the specifiers can be used to protect … Read more

Categories C#

C Sharp Namespaces

C# Namespaces To easily handle an application, too many classes are organized in C# using the Namespaces. The System.Console is used in a simple C# program. Here, System is the namespace and Console is the class. The namespacename.classname can be used to access the class of a namespace. To not use the complete name all … Read more

Categories C#

C Sharp Interface

C# Interface In C#, an interface can be understood as a blueprint of a class. All the methods declared inside the interface are abstract methods, and thus it is similar to an abstract class. The method body is not present in a C# interface. Also, a C# interface cannot be instantiated. A class can’t achieve … Read more

Categories C#

C Sharp Abstract

C# Abstract To achieve abstraction in C#, the Abstract classes are used. To hide the internal details and to display only the functionality, the process of abstraction is used in C#. There are two ways to achieve Abstraction: Abstract class and Interface. Abstract methods are necessary for abstraction and are present in the Abstract class … Read more

Categories C#

C Sharp Sealed

C# Sealed To apply restrictions on the class and the method in C#, the sealed keyword is used. When created, a sealed class can’t be derived. However, a sealed method can’t be overridden when created. Structs can’t be inherited, because they are implicitly sealed. C# Sealed class: Any class can’t derive a sealed class in … Read more

Categories C#

C Sharp Polymorphism

C# Polymorphism Being a combination of “poly” and “morphs”, the term “Polymorphism” is a Greek word that means many forms. The principal concepts of an object-oriented programming language are an inheritance, encapsulation, and polymorphism. C# supports two types of polymorphism: compile time polymorphism and runtime polymorphism. Compile-time polymorphism: Method overloading and operator overloading are used … Read more

Categories C#

C Sharp Base

C# Base To access fields, constructors and methods of the base class in C#, the base keyword is used within an instance method, constructor or instance property accessor and not within the static method. C# base keyword: accessing the base class field: The base keyword can be used to access the fields of the base … Read more

Categories C#

C Sharp Method Overriding

C# Method Overriding Method overriding in C# is the process where the derived class defines the same method as defined in its base class. To obtain runtime polymorphism, and to provide a specific implementation of the method is already provided by the base class, the method overriding is used. The virtual keyword is used with … Read more

Categories C#

C Sharp Member Overloading

C# Member Overloading Member overloading in C# is the process of creating two or more members having the same name but they are different in number or type of parameters. Methods, constructors, and indexed properties have parameters only and thus can be overloaded in C#. C# Method Overloading: Method overloading in C# is the process … Read more

Categories C#