What is an principles of Object oriented programming

How1.Objects

 Objects are the basic unit of OOP. They are instances of class, which have data members 

and uses various member functions to perform tasks.

Why2.Class

 It is similar to structures in C language. Class can also be defined as user defined data type 

but it also contains functions in it. So, class is basically a blueprint for object. It declare & 

defines what data variables the object will have and what operations can be performed on 

the class's object.

Witch3.Abstraction

 Abstraction refers to showing only the essential features of the application and hiding the 

details. In C++, classes can provide methods to the outside world to access & use the data 

variables, keeping the variables hidden from direct access, or classes can even declare 

everything accessible to everyone, or maybe just to the classes inheriting it. This can be 

done using access specifiers.

How4.Encapsulation

 It can also be said data binding. Encapsulation is all about binding the data variables and 

functions together in class.

Why5.Inheritance

 Inheritance is a way to reuse once written code again and again. The class which 

is inherited is called the Base class & the class which inherits is called 

the Derived class. They are also called parent and child class.

 So when, a derived class inherits a base class, the derived class can use all the what6.Polymorphism

 It is a feature, which lets us create functions with same name but different arguments,

which will perform different actions. That means, functions with same name, but

functioning in different ways. Or, it also allows us to redefine a function to provide it

with a completely new definition. You will learn how to do this in details soon in coming

lessons.

This7.Exception Handling

 Exception handling is a feature of OOP, to handle unresolved exceptions or errors

produced at runtime.

Why Keywords

 Keywords in C++ refer to the pre-existing, reserved words, each holding its own 

position and power and has a specific function associated with it.

 It is important to note that we cannot use C++ keywords for assigning variable names as 

it would suggest a totally different meaning entirely and would be incorrect.

WitchIdentifiers

 C++ allows the programmer to assign names of his own choice to variables, arrays, 

functions, structures, classes, and various other data structures called identifiers. The 

programmer may use the mixture of different types of character sets available in C++ to 

name an identifier.

Rules for C++ Identifiers

There are certain rules to be followed by the user while naming identifiers, otherwise, you would 

get a compilation error. These rules are:

What 1. First character: The first character of the identifier in C++ should positively begin with 

either an alphabet or an underscore. It means that it strictly cannot begin with a number.

This2. No special characters: C++ does not encourage the use of special characters while 

naming an identifier. It is evident that we cannot use special characters like the 

exclamatory mark or the “@” symbol.

Why3. No keywords: Using keywords as identifiers in C++ is strictly forbidden, as they are 

reserved words that hold a special meaning to the C++ compiler. If used purposely, you 

would get a compilation error.

What4. No white spaces: Leaving a gap between identifiers is discouraged. White spaces 

incorporate blank spaces, newline, carriage return, and horizontal tab.

 

Enjoyed this article? Stay informed by joining our newsletter!

Comments

You must be logged in to post a comment.

About Author