What is Abstraction and Encapsulation.


Abstraction :-
        Refers to the process of exposing only the relevant and essential data.

Encapsulation :-
        Hide the complexity. " Encapsulation is hide it's member from outside class or interface.

Difference between Abstraction and Encapsulation :-
Example :-

             
public class Customer
{
     // Abstraction
      public string customerCode =" ";
      public string customerName =" ";
      public void Add()
      {
          Validate();
          CreateDBobject();
       }
      // Encapsulation
     private bool Validate()
    {
        return true;
     }
     private bool CreateDBobject()
     {

      }
}

Share

& Comment

0 comments:

Post a Comment

 

Copyright © 2019 HART™ is a registered trademark.