OOPS


Oops concepts:
1. Class
2. Methods and Function
3. Polymorphism
4. Inheritance
5. Constructor
6. Abstract class
7. Interface class
8. Encapsulation
Class:
It is a collection of different variables and methods.
(Method- Function without return type is called method.)

Namespace:
It is the logical collection of user defined data types.
Access specifier:
It will specify the class, it has 5 types.
1. Public
2. Private
3. Protected
4. Internal
5. Protected Internal
1.Public:
It can be accessed outside of the class.
2.Private:
It cannot be accessed outside of the class.



3. Protected:
It is same as private, but it can be inherited but cannot be used outside of the class by instant of object.


4. Internal:
Same as public but it can be accessed by code within same class.
5. Protected Internal:
It is same as the internal but it can be accessed by code of the assembly.





Access Modifier:
It modifies the access of the class.
1. Sealed
2. Static
3. Abstract
4. Virtual
Sealed:
If you mark a method as sealed then we cannot access the method.
Static:
1. Static Method
2. Static Class
3. Static Constructor

Static Method:
Static method contained in static class can access only by class name.
Static Class:
Instant for a static class never be created
(In .net all class library are static class)

Static Constructor:
Only single object can be created. To initialize a static variable we need to use static constructor, a static constructor must be parameter less.
(Constant: constant value once set cannot be altered throughout the program.)

Constructor:
1. It is a special member function, whose name is same name as that of class name.
2. It doesn’t have a return type.
3. Constructor can be parameterized or we can have default constructor also.
4. It is used to initialize the object of a class.

There are three types of constructors
a. Default constructor
b. Parameterized constructor
c. Copy constructor
d. Static constructor.
Static Constructor:
Only single object can be created. To initialize a static variable we need to use static constructor, a static constructor must be parameter less.
Copy Constructor:

Destructor:
It is denoted by the symbol(~),it has same name as that of a constructor, and it is used to destroy the object created by the constructor. Only
One destructor is enough to destroy all the objects

No comments:

Post a Comment