Posts

Showing posts with the label OOPs Concepts in C#

OOPs Concepts in C#

OOPs Concepts in C# Object-Oriented Programming (OOP) is a programming paradigm that revolves around the concept of "objects." These objects have properties (data) and behaviors (methods). C# is a powerful language that fully supports OOP principles. Let's delve into the core concepts: 1. Encapsulation  * Hiding Implementation Details: Encapsulation involves bundling data (attributes) and methods (functions) that operate on that data within a single unit called a class.  * Access Modifiers: C# provides access modifiers like public, private, protected, and internal to control the visibility of class members.  * Example: public class Person {     private string name;     private int age;     public void SetName(string name)     {         this.name = name;     }     public string GetName()     {         return name;     }     // ... other methods ...