fbpx

It is necessary to understand some of the concepts used extensively in object oriented programming.These include
a. Objects
b. Classes
c. Data abstraction and encapsulation
d. Inheritance
e. Polymorphism
f. Dynamic Binding
g. Message passing.

Polymorphism means one name, multiple forms. It allows us to have more than one function with the same name in a program.It allows us to have overloading of operators so that an operation can exhibit different behaviours in different instances.

The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.

The smallest individual units of a program is known as tokens. c++ has the following tokens :
a. Keywords
b. Identifiers
c. Constants
d. Strings
e. Operators

A constructor that accepts no parameters is called the default constructor. If no user-defined constructor exists for a class A and one is needed, the compiler implicitly declares a default parameter less constructor A::A(). This constructor is an inline public member of its class. The compiler will implicitly define A::A() when the compiler uses this constructor to create an object of type A. The constructor will have no constructor initializer and a null body.

C requires all the variables to be declared at the beginning of a scope but in C++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.

A class is a collection of objects.

The mechanism of deriving a new class (derived) from an old class (base class) is called inheritance. It allows the extension and reuse of existing code without having to rewrite the code from scratch. Inheritance is the process by which objects of one class acquire properties of objects of another class.

a. All the features of C issimilar to C++ except some features, such as polymorphism, operator overloading which are supported in C++ but not in C language.
b. Both C and C++ language is similiar in their functionality but C++ provides with more tools and options.

An object oriented program consists of a set of objects that communicate with each other. Message passing involves specifying the name of the object, the name of the function and the information to be sent.

An enumerated data type is another user defined type which provides a way for attaching names to numbers thereby increasing comprehensibility of the code. The enum keyword automatically enumerates a list of words by assigning those values 0,1,2, and so on.

A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class.

a. A destructor is called for a class object when that object passes out of scope or is explicitly deleted.
b. A destructors as the name implies is used to destroy the objects that have been created by a constructors.
c. Like a constructor, the destructor is a member function whose name is the same as the class name but is preceded by a tilde.

a. It offers an improved macro facility.
b. By using the inline functions, the user can split a large function with many nested modules of statement blocks into many small inline functions.

http://www.itsdigitalindia.com/wp-login.php?redirect_to=http%3A%2F%2Fitsdigitalindia.com%2Fwp-admin%2F&reauth=1