Saturday, 20 July 2024

Class and Object

 

Class is Blueprint & Object is Physical form of class.

Class:

At its core, a class in C# defines the structure and behaviour of objects. It acts as a template or prototype from which individual objects are created.

 

Class and Object are the basic concepts of Object-Oriented Programming which revolve around the real-life entities.

A class is a user-defined blueprint or prototype from which objects are created.

Basically, a class combines the fields and methods(member function which defines actions) into a single unit.

In C#, classes support polymorphism, inheritance and also provide the concept of derived classes and base classes.

 


Class Key points : 

·       String, int ,Boolean and float are inbuilt types where as Class is User Defined Type or Data structure.

·       Integer represents number, string represents text likewise if you want to represent any real world Object example

·       you can create user defined type using class.

·       Class is blue print to create object.

·       A Class Consists of two things.

·       Attributes – Variables

·       Behavior - Methods (Functions)

·       Class is Container where you put all your Variables and Methods.

 

Programming Languages without Class Concept

·       Go (Golang)

·       Rust,

·       Kotlin (in the context of scripting)

·       Dart (in the context of Flutter) ,

·       Swift

 






No comments:

Post a Comment

Thanks for the contribution, our team will check and reply back if response required.