What is C++?
C++ is a object-oriented programming language developed by Bjourne Stroustrup at Bell Laboratories during 1983-1985 as a superset of the C language. C++ to date is one of the most widely used, powerful programming languages. It perhaps surpasses any other programming language in performance even today, with other object oriented languages around like Java.
What is an Object?
An object is a representation of a type that holds data and allows operations to be performed on it self. An Object lets us describe our concept, type or idea in terms of data and methods.
Thus becomes a basis for a modular analysis of our problem. The whole problem and solution domain can be represented in terms of objects; objects can interact with themselves producing results. Read the answer to the question a What is Class? To understand objects better.
What is a Class?
Objects of the same type fall into a Class. Consider for example a Car. A Car can be represented as a Class with a state variable of price and methods like Stop, Move etc.
Now Mercedes can be an object of type or class Car with a price of $XX, whereas Buick can be an Object of type or Class Car with price of $YY. Hence Objects of a Class are similar except for their state.
What is Polymorphism?
In OOP terms, polymorphism represents the ability to resolve a reference to an object’s method at run time. Specifically, different objects could make a call to a Draw or Print method, and these methods would act differently with each object; the process can take different forms behind a common interface. One of the benefits of polymorphism is that because the interface is common to objects, any object is able to respond differently to some common set of tasks, and objects are independent of each other.
What is Object Oriented Programming (OOP)?
Object- Oriented Programming (OOP) is an approach to program organization and development that attempts to eliminate some of the pitfalls of conventional programming methods by in incorporating the best of structured programming features with several powerful new concepts. It is a new way of organising and developing programs and has nothing to do with any particular language. However, not all languages are suitable to implement the OPP concepts easily.
What is Inheritance?
In object-oriented programming of computer science, an inheritance is a way to form new classes (instances of which will be objects) using pre-defined objects or classes where new ones simply take over old ones’s implemetions and characterstics. It is intended to help reuse of existing code with little or no modification.
The term originates with the biological concept of a parent passing on certain traits to a child.
What is Encapsulation?
Programming errors can be minimized if data can be changed only in a well regulated way. Encapsulation is a means of enforcing such regulation, by allowing access to the data only through a class interface. This is also known as data hiding.
What are Constructors and Destructors?
A constructor is a special method that is created when the object is created or defined. This particular method holds the same name as that of the object and it initializes the instance of the object whenever that object is created. The constructor also usually holds the initializations of the different declared member variables of its object. Unlike some of the other methods, the constructor does not return a value, not even void.
As opposed to a constructor, a destructor is called when a program has finished using an instance of an object. A destructor does the cleaning behind the scenes. Like the default constructor, the compiler always create a default destructor if you don’t create one. Like the default constructor, a destructor also has the same name as its object.
What are Virtual Functions?
An ancestor function that has no code. Used in polymorphism. Also referred to as stub or prototype function.
A C++ member function that is declared with the keyword virtual. The implementation that is executed when you make a call to a virtual function depends on the type of the object for which it is called. This is determined at run time.
What is an Abstract classe?
In object-oriented programming, a class designed only as a parent from which sub-classes may be derived, but which is not itself suitable for instantiation. Often used to “abstract out” incomplete sets of features which may then be shared by a group of sibling sub-classes which add different variations of the missing pieces.
What are Copy Constructors?
In C++, a constructor that takes an instance of the class as its parameter and sets the data members to match the value of that instance.
What is Operator Overloading?
Use of a single symbol to represent operators with different argument types, eg “-” used either as a monadic operator to negate an expression or as a dyadic operator to return the difference between two expressions. Another example is “+” used to add either floating-point numbers or matrices. Overloading is also known as ad hoc polymorphism.
What is Function Overloading?
In object-oriented programming, a technique in which two or more functions with the same name are distinguished from one another by differing number and/or type of parameters.
What are Inline functions?
In OOP, an inline function is a programming language construct used to suggest to a compiler that a particular function be subjected to in-line expansion; that is, it suggests that the compiler insert the complete body of the function in every context where that function is used.