Friday, 9 August 2013

What is c++ ?
Ans:  c++  is  an object oriented  language developed  by    Bjarne Stroustrup in 1979.
       Shortly thereafter, he began work on "C with Classes", which as the name implies was meant to be a superset of the C language. His goal was to add object-oriented programming into the C language, which was and still is a language well-respected for its portability without sacrificing speed or low-level functionality. His language includedclasses, basic inheritanceinliningdefault function arguments, and strong type checking in addition to all the features of the C language.

The first C with Classes compiler was called Cfront, which was derived from a C compiler called CPre. It was a program designed to translate C with Classes code to ordinary C. A rather interesting point worth noting is that Cfront was written mostly in C with Classes, making it a self-hosting compiler (a compiler that can compile itself). Cfront would later be abandoned in 1993 after it became difficult to integrate new features into it, namely C++exceptions. Nonetheless, Cfront made a huge impact on the implementations of future compilers and on the Unix operating system.

What is Object?
Ans:Every thing in the world is object.
An object is an instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable.
 Everything is an object :Think of an object as a fancy variable; it stores data, but you can “make requests” to that
object, asking it to perform operations on itself. In theory,you can take any conceptual component in the problem
you’re trying to solve (dogs, buildings, services, etc.) and represent it as an object in your program.
 A program is a bunch of objects telling each other what to do by sending message:To make a request of an object, you “send a message” to that object. More concretely, you can think of a message as a request to call a function that belongs to a particular object.
Each object has its own memory made up of other objects. Put another way, you create a new kind of  object by making a package containing existing objects. Thus,you can build complexity in a program while hiding it behind the simplicity of objects.
Every object has a type. Using the parlance, each object is an instance of a class, in which “class” is synonymous with
“type.” The most important distinguishing characteristic of a class is “What messages can you send to it?”
All objects of a particular type can receive the same messages. This is actually a loaded statement, as you will see later. Because an object of type “circle” is also an object of type “shape,” a circle is guaranteed to accept shape messages. This means you can write code that talks to shapes and automatically handles anything that fits the description of a shape. This substitutability is one of the most powerful concepts in OOP.

No comments:

Post a Comment