OOPS stand for Object Oriented Programming. It is a design
principle for developing an application\Software.
Everything in OOPS is related
to Object.
OOPS have four main concepts: Abstractions,
Encapsulation, Polymorphism and Inheritance.
OOPS(Object Oriented Programming) is programming model
where programs are organized around objects and data rather than action and
logic.
Class:-
A class is a construct that enables you to create your
own custom types by grouping variables of other type, methods and events.
A class is a blueprint of an object. It defines the
data and behavior of type. We can also called, class is a collection of Objects.
A class is the pillar or core of any modern OOPS language.
Class Syntax :-
class Class_Name
{
// Fields, Methods,
Properies and Events goes here
}
The name of the class always followed by class keyword.
A class will not occupy any memory space and it only a
logical representation of data. When we create an object of class that time
object will hold the memories.
Every class has a constructor and destructors. A
constructor is called automatically any time an instance or object of a class
is created.
A class is reference type.
Types of Class:-
- Abstract Class
- Partial Class
- Sealed Class
- Static Class
Object:-
- Object is an instance of class.
- Object is a real world entity (ex. A person or a place).
- Object is basically a block of memory that has been allocated and configured to according to the blueprint. A program may create many object s of same class.
- Objects can be stored either in a named variable or in an array or collections.
- When we make a class as static class then we cannot create instance or object of the class.
- When create an object using new operator, memory allocate for the class is on Heap.
Example for Creation An object of class.
Program objProgram = new Program();
Here Program is a class
and objProgram is an object of class Program.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.