Access Levels

Below is the example to understand the access modifier in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp
{
    public class AccessLevels
    {
        public AccessLevels() { 
        
        }
        public int intPublic; //unrestricted access.
        protected int intProtected;//own or derived class.
        internal int intInternal;//own assembly.
        protected internal int intProtectedInternal;//own assembly or derived.
        private int intPrivate;//own class only.

        //All are accessible in same class.
        public void AccessibleInSameClass() {
            intPublic = 0;
            intProtected = 0;
            intInternal = 0;
            intProtectedInternal = 0;
            intPrivate = 0;
        }
    }

    //Private members are not accessible in derived class.
    public class DerivedAccessLevels : AccessLevels {
        public void AccessibleLevels() {
            intPublic = 0;
            intProtected = 0;
            intInternal = 0;
            intProtectedInternal =0;
        }
    }

    //Only Public, Protected Internal And Internal are accessible in another class.
    public class AnotherClass {
        public void fnAccess(AccessLevels objAccessLevels) {
            objAccessLevels.intPublic = 0;
            objAccessLevels.intInternal = 0;
            objAccessLevels.intProtectedInternal = 0;
        }
    }
}

#access-modifier