Use C# .NET Core Framework, data annotations to the models
C# Coding
C# in .Net framework with SQL Server
Sunday, October 25, 2020
Thursday, September 17, 2020
Object-Oriented Programming Concepts
- Encapsulation
- Abstraction
- Inheritance
- Polymorphism
Encapsulation
Binding multiple data and functions together in a packet. In coding you find a Class that keep related data and functions as a bundle.
Abstraction
Hiding the logic of functions from user (hiding implementation part).
In coding :
Console.WriteLine(); you cant see definition of WriteLine
Inheritance
If Class B inherited from Class A, Class B able to access functions in Class A .
But depend on access modifiers been assigned with functions.
if functions are public or protected in Main class, inherited class can access.
access to Protected function from only first level inherited class
Noted : One class get inherited from Many classes
Polymorphism
"Poly" means Many "morphism" means Forms
If classes inherited from one to many in a hierarchy,There are parent class and its descendants. Meanwhile, the same operation name among objects in an inheritance hierarchy may behave differently.
In terms of Functionality, Polymorphism derives to Static and Dynamic.
Static (Design-Time)
This is Function Overloading. When we create two or more functions with same name but with different Signatures.
there are two types:
a. Different number of parameters,
Public double Area (double r) Public double Area (double i, double j)
{ {
double result =3.14*r*r; double result =i*j;
} }
b. Same number of parameters but different Data Types,
Dynamic (Run-Time)
This is Function Overriding. Bass Class pointer can point to any of its derived class.
Base class EMP Derived Class Manager
public double virtual Bonus() public double override Bonus()
{ {
double PayRate = 0.01 double PayRate = 0.02
return PayRate; return PayRate;
} }
EMP obj; // Create object
obj=new EMP(); //object pointing to Bass class
or
obj = new Manager(); // object pointing to Derived class
obj.Bonus(); //calling the function
Note: But remember to use "Virtual "and "Override "terms
CRUD (Create, Update, Delete) MVC with React
Use C# .NET Core Framework, data annotations to the models
-
Use C# .NET Core Framework, data annotations to the models
-
Object-Oriented Programming Concepts Encapsulation Abstraction Inheritance Polymorphism Encapsulation Binding multiple data and functions ...