Data Security

Introduction

जब किसी program में data को store और process किया जाता है, तब यह आवश्यक होता है कि उस data को गलत उपयोग, unauthorized access और accidental modification से सुरक्षित रखा जाए। जैसे-जैसे software systems बड़े और जटिल होते जाते हैं, data की सुरक्षा और भी महत्वपूर्ण हो जाती है।

Object Oriented Programming में data security को सुनिश्चित करने के लिए कई concepts का उपयोग किया जाता है, जैसे Data Hiding, Encapsulation और Access Control। इनकी सहायता से data को केवल निर्धारित और सुरक्षित तरीकों से ही access किया जा सकता है।

Definition of Data Security

Data Security वह प्रक्रिया है जिसमें program के data को unauthorized access, modification और misuse से सुरक्षित रखा जाता है, ताकि data केवल authorized methods के माध्यम से ही उपयोग किया जा सके।

OOP में Data Security कैसे प्राप्त होती है?

Data Security को OOP में निम्न तरीकों से प्राप्त किया जाता है:

1. Access Specifiers

  • private → केवल class के अंदर access
  • public → हर जगह access

private data members data को सुरक्षित रखते हैं।

2. Encapsulation

Data और functions को एक साथ bind करके data को direct access से बचाया जाता है।

3. Controlled Access

Data को केवल member functions (जैसे getter और setter) के माध्यम से access किया जाता है।

C++ में Data Security का उदाहरण

#include <iostream>
using namespace std;

class BankAccount {

private:
int balance;

public:
void deposit(int amount) {
balance = balance + amount;
}

void showBalance() {
cout << "Balance: " << balance;
}
};

int main() {
BankAccount b1;

// b1.balance = 5000; // not allowed

b1.deposit(5000);
b1.showBalance();

return 0;
}

Output:

Balance: 5000

Working को समझना

  • balance को private रखा गया है
  • इसे सीधे access नहीं किया जा सकता
  • deposit() function के माध्यम से value update की गई
  • showBalance() के माध्यम से value दिखाई गई
  • Data पूरी तरह सुरक्षित रहा

Data Security के लाभ

  • Unauthorized access से सुरक्षा
  • Data corruption से बचाव
  • Program की reliability बढ़ती है
  • Sensitive data सुरक्षित रहता है

Real Life Example

Bank account का balance सीधे कोई भी change नहीं कर सकता।
केवल authorized operations (deposit, withdraw) के माध्यम से ही balance update होता है।
यह Data Security का वास्तविक उदाहरण है।

निष्कर्ष

Data Security OOP का एक महत्वपूर्ण पहलू है जो data को सुरक्षित रखने और नियंत्रित तरीके से उपयोग करने की सुविधा प्रदान करता है। Access control, encapsulation और data hiding के माध्यम से program को अधिक सुरक्षित और विश्वसनीय बनाया जाता है।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top