Introduction
As the name suggested private access specified allow a class to hide its member variable and member functions from other function and objects. It can be function of the same class access private members and instance of a class cannot access its private members.
Example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace pivate_access_specifier
{
class rectangle
{
private double length; /*Private member variable define Length and width , which cannot be access in
main() function. The member function Getdetails() , Returnarea() and Display()
can access this variables*/
private double width;
public void Getdetails()
{
Console.WriteLine("Enter lengte of Rectangle=");
length =Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter Width of Rectangle=");


Join the conversation! Your thoughts help the community grow.