Identifiers and Keywords | Object Oriented Programming (OOP)

Download our Android App from Google Play Store and start reading Reference Notes Offline.

identifiers and keywordsIdentifiers and Keywords
Object Oriented Programming(OOP)
Third Semester | Second year
BSc.CSIT | Tribhuvan University (TU)

A symbolic name is generally known as an identifier. valid identifiers are a sequence of one or more letters, digits or underscore characters (_). Neither spaces nor punctuation marks or symbols can be part of an identifier. Only letters, digits and single underscore characters are valid.

In addition, variable identifiers always have to begin with a letter. In no case can they begin with a digit. Another rule for declaring identifiers is that they shouldn’t match any keyword of the C++ programming language. The rules for the formation of identifier can be summarized as;

  • An identifier may include of alphabets, digits and/or underscores. It must not start with a digit.
  • C++ is case sensitive, i.e, upper case and lower case letters are considered totally different from each other. It may be noted that TOTAL and total are two different identifier names.
  • It should not be a reserved word.

A member function with the same name as its class is called constructor and it is used to initialize the objects of that class type with an initial value. Objects generally need to initialize variables or assign dynamic memory during their process of creation to become operative and to avoid returning unexpected values during their execution.

There are some reserved words in C++ which have predefined meaning to compiler called keywords. These are also known as reserved words and are always written or typed in lower cases. There are following keywords in C++ object oriented language;

List of Keywords

asm double new switch
auto else operator template
break enum private this
case extern protected try
catch float public typedef
char for register union
class friend return unsigned
const goto short virtual
continue if signed void
default inline sizeof volatile
delete int static while
do long struct


(Visited 1,504 times, 1 visits today)

Posted By : Digvijay | Comment RSS | Category : Third Semester
Tag :

Post a Comment

Your email is never published nor shared. Required fields are marked *


Wordpress DMCA
Community | Toolbar | Android App | Founder/Developer : Hari Prasad Chaudhary | CSIT Portal Manager : Digvijay Chaudhary