C++

This new topic was asked by one of blog reader and friend of mine.

So starting with C++: It was developed by Bjarne Stroustrup in 1979 at Bell Labs as an upgrade to the C language and originally named C with Classes. It name was changed to C++ in 1983. Its the middle level language as it has the features of high level language and a low level language too. As we all agree to the point that the C++ (used the increment operator in C as its an enhancement of C) is the starting of the Object Oriented Programming Language. So object Orientation can be described as “The Software modelling and development disciplines that make it easy to construct complex systems from individual components”

The first computers were programmed in binary along with mechanical switches. Earlier programming languages were inadequate for developing complex computer programs. There was no facility to reuse the code in the linear programming languages the code was duplicated and used in programs wherever it was necessary. The solution to this was structured programming in which the program is broken in number of procedures which are known as functions and different tasks are performed.

Now shifting towards the Object oriented paradigm. This is built on the foundation of Structured programming and data abstraction. The main change is that the program is designed around the data being operated on rather than the operation. As an upgrade to C the language first adding classes, then virtual functions, operator overloading, multiple inheritance, templates, and exception handling.

The main concepts introduced in Object Oriented Programming:

  1. Class: A class is a construct that is used as a template to create objects of that class. In other words its the extension of the structures in C.
  2. Objects: These are the instances of the Classes created runtime
  3. Data Abstraction and Encapsulation:  Abstraction is the concept of structured programming and used in C++ too whereas encapsulation means the wrapping up of data into single unit.
  4. Inheritance: When the derived classes are created from the classes called as base classes then it is called as inheritance
  5. Virtual Function: The concept of virtual function is the same as a function, but it does not really exist although it appears in needed places in a program.
  6. Templates: This allows us to create a function template which can be adapted for more than one type or class with no need to retype the entire code again for another type.
  7. Polymorphism: It is the ability to use function or operator in different ways.

There are some other features such as dynamic binding , constructors, easy way to handle files are also there.

The Key advantages are :

  • we can extend the use of existing classes.
  • Helps to build secure code.
  • Message passing techniques to communicate between objects.
  • Multiple instances of object can coexist.
  • Software complexity can be easily managed.
  • iostream makes it faster than stdio

Thats it for this time will explain few more things(concepts) related to C++.

Till then Good Bye.. 🙂

Advertisements

Which level language C is?

Hello guys…

So C was developed by Dennis Ritchie in 1972 at AT&T Bell Laboratories and C is the most popular programming language for all time.

So lets get to the topic What is the level of C ? Is it Middle level or low level or High Level language?

There are various pros and cons related to this and other controversies too.

We can say that it is High level of language because we are using keywords such as if-else, for , while etc which are just as in our common language.

Secondly we can say that it is a low level language because there are pointers and memory addressing.

And finally there is something for Middle level too because it is largely used in system programming such as hardware configuration and interrupt handling. And it is the mixture of pascal (High level) language and assembly (Low Level) Language. So it can be called as middle level language.

Now when we assign or declare some array in C then the name of the array refers to the starting address of the array in memory ie. the address where the array begins in memory. The array elements are stored in contiguous memory locations. The length of array  is not remembered in the array itself. The indexing of array don’t start with 1 it starts with 0. The Multidimensional array is stored in contiguous memory locations ie they are stored row wise not column wise.

C don’t support the nesting of functions (at physical hardware level). In C the value is returned by function but it is ignored. It supports variable length argument list.The function name is converted to pointer ie. it can be thought of as an address ie the address to which control is transferred when that function is called .The return values of function can be used as l-values. For example float *fun(); we can write it as *fun()=5.0;

This allows us System programming as well as application programming so its a middle level language.This is the beauty of the C..!

Enjoy and have a Happy Programming.. 🙂