Posts

Showing posts with the label OOPs Concepts

OOPS Concepts in Kotlin

  Kotlin is a modern, statically-typed programming language that fully supports   Object-Oriented Programming (OOP)   concepts. Below is an explanation of the four main OOP concepts in Kotlin, along with examples. 1.   Encapsulation Encapsulation is the practice of bundling data (properties) and methods (functions) that operate on the data into a single unit, called a   class . It also involves restricting direct access to some of an object's components, which is achieved using   access modifiers .

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 ...