Access Specifiers Flashcards

1
Q

internal

A

https://www.completecsharptutorial.com/basic/internal.php

 In this chapter you will learn:
 What is internal access specifier?
 What is the boundary of internal access specifier?
 How to use internal access specifier in C# programming?
The internal access specifier hides its member variables and methods from other classes and objects, that is resides in other namespace. The variable or classes that are declared with internal can be access by any member within application. It is the default access specifiers for a class in C# programming.
Example:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Internal_Access_Specifier
{
    class access
    {
        // String Variable declared as internal
        internal string name;
        public void print()
        {
            Console.WriteLine("\nMy name is " + name);
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            access ac = new access();
            Console.Write("Enter your name:\t");
            // Accepting value in internal variable
            ac.name = Console.ReadLine();
            ac.print();
            Console.ReadLine();
        }
    }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly