| |
|
What is Encapsulation?
Encapsulation - is the ability of an object to hide its data and methods from
the rest of the world. It is one of the fundamental principles of OOPs.
Say we create a class, named Calculations. This class may contain a few members in the
form of properties, events, fields or methods. Once the class is created, we may
instantiate the class by creating an object out of it. The object acts as an
instance of this class, the members of the class are not exposed to the outer
world directly, rather, they are encapsulated by the class.
Example:
Public class Calculations
{
private void fnMultiply(int x, int y)
{
return x * y;
}
}
...
...
Calculations obj;
int Result;
Result = obj.fnMultiply(5,10);
OOPs
Class
Encapsulation
Inheritance
Class Member
Polymorphism
Property Event
Access Modifier
Overloading
Shared
Virtual
Overridable Overrides Mustoverride
Shadows
Constructor
Static Constructor
Serialization
Delegate
Abstract
Interface
Multiple Inheritance
| |