Visual Explanation of Access Specifiers in OOPs

Access specifiers  (or access modifiers) are keywords in object-oriented languages that set the accessibility of classes, methods, and other members. Access modifiers are a specific part of programming language syntax used to facilitate the encapsulation of components.

There are 5 access modifiers.

  1. Private: Accessible only within the class.
  2. Protected: Accessible within the class and its derived classes.
  3. Internal: Accessible anywhere within the current project or assembly.
  4. Protected internal: Accessible with current project and derived classes.
  5. Public: Accessible everywhere.
Access specifier
Access specifier

 

Add Gravatar to your web sites using PHP & C#

Gravatar (an abbreviation for globally recognized avatar) is a service for providing globally unique avatars which was created by Tom Preston-Werner. On Gravatar, users can register an account based on their email address, and upload an avatar to be associated with the account. Gravatar plugins are available for popular blogging software; when the user posts a comment on such a blog that requires an e-mail address, the blogging software checks whether that e-mail address has an associated avatar at Gravatar.

PHP:


function GetAvatar($email)
{
   $emailMD5 = md5($email);
   $gravatarURL = "http://www.gravatar.com/avatar/" . $emailMD5 . ".jpg";
   $html="<img src='$gravatarURL' />"; return $html;
}

C#:


public string GetAvatar(string Email)
{
   string emailMd5 = Utilities.Encryption.MD5.ComputeHash(Email.Trim().ToLower()).ToLower();
   string gravatarURL = "http://www.gravatar.com/avatar/" + emailMD5 + ".jpg";
   string html = "<img src='" + $gravatarURL + "' />"; return html;
}