Abstract class in C#

 

 

Polymorphism: Method Overloading and Method Overriding and Method Hiding

Method Overriding:

another good exmple:

this video is good for learning overriding:

Method Hiding:

 

Aggregation in OOP

I will discuss more later.

Inheritance in C#

Single Level Inheitance: Inheriting Fields

Single Level Inheritance: Inheriting Methods

Multilevel Inheritance:

Multiple Inheritance Through Interface:

 

 

 

Encapsulation in C#

 

C# Access Modifiers/Specifiers

C# Provides five types of access specifiers:

They are: Public, Private, Protected, Internal, Protected Internal

Public – It specifies that access is not restricted
Protected- It specifies that access is limited to the containing  class or in a derived class
Internal – It specifies that access is limited to the current assembly
Protected Internal – It specifes that access is limited to the current asembly or types from the derived class
Private – It specifies that acess is limited to the containing type

this video will surely help to understand:

Now lets see the example:
public:

protected:

output: it will show error

but we can show the output through some tricks

output:

Internal:

Protected Internal:

private:

eg 1:

eg 2:

 

 

 

 

 

 

 

 

C# Structs works almost like a Class !

 

 

How many constructor a class have in C# ?

Is it known as constructor overloading ?

 

 

C# usage of Static Keyword

Static Class Example:

Static Constructor:

 

 

 

 

C# Constructor and Destructor

Destructor:

 

 

C# Object and Classes

 

Story, Motivation about Life!

#Collected From a Facebook Post

Difference between Out and Ref keyword in C#

https://www.javatpoint.com/c-sharp-call-by-reference

https://www.javatpoint.com/c-sharp-out-parameter

 

 

 

.NET Components

 

http://www.developerin.net/a/39-Intro-to-.Net-FrameWork/23-Components-of-.Net-Framework

Calling Method Example in C#

code:

with object creation from class:

If we don’t want to use object we can use static keyword here:

Static method can be invoked with class name:

Can be invoked without creating objects: