The mechanism of deriving a new class (derived) from an old class (base class). It allows the extension and reuse of existing code without having to rewrite the code from scratch.Additionally, it is the process by which objects of one class acquire properties of objects of another class.
What is C++?
This language is created by Bjarne Stroustrup of AT&T Bell Labs as an extension of C, it is an object-oriented computer language used in the development of enterprise and commercial applications.
The basic concepts of object oriented programming (List)
Data abstraction and encapsulation
This concept means one name, multipleforms. It allows us to have more than one function with the same name in a program.It allows us to have overloadingof operatorsso that an operation can exhibit differentbehaviors in different instances.
What are the features of C++ different from C?
All the features of C are similiar to C++ except some features, such as polymorphism, operator overloading which are supported in C++ but not in the C language.
Both C and C++ language is similar in their functionality but C++ provides with more tools and options.
The wrappingup of data and functions into a single unit (called class). Containing and hiding information about an object, such as internal datastructures and code.
An object oriented program consists of a set of objects that communicate with each other.
This involves specifying the name of the object, the name of the function and the information to be sent.
Tokens in C++ (def'n)
The smallest individual units of a program.
What is the use of enumerated data type?
This is another userdefined type which provides a way for attaching names.
to numbers thereby increasingcomprehensibilityof the code.
(Default Constructor)If no user-defined constructor exists for a class A and one is needed, the compiler __?__.
(Constructors)A constructor that accepts no parameters is called the __?___.
(Default Constructor) This constructor is an inline __?___.
(Default Constructor) The compiler will implicitly define the Default Constructor A::A() when the compiler:
(Constructors)What type of constructor has no constructor initializer and a null body?
A member function with the same name as its class, and it is invoked whenever an object of its associated class is created.
(Constructors) A constructor is called constructor because___?____.
It constructs the valuesof data membersof the class.
How variable declaration in c++ differs that in c.
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.
Is called for a class object when that objectpasses out of scope or is explicitly deleted.
Is used to destroythe objectsthat have been created by a constructors.
Is a member function whose name is the same as the class name but is precededby a tilde
A collection of objects.
What is the differencebetween C & C++?
C++ is a an object oriented programing but C is a procedureorientedprograming.
C is super set of C++
C can’t supportinheritance, functionoverloading, method overloading etc. but c++ can do this.
In c program the mainfunctioncould notreturn a value but in the c++ the main function should return a value.
(Inline Function) Inline function advantages (?)
It offers an improvedmacrofacility.
The user can split a large function with many nested modules of statement blocks into many smallinlinefunctions.
Copy Constructor (def'n)
A constructor function with the same name as the class and used to make deepcopyof objects.
Default Constructor (def'n)
A constructorthat either has no parameters, or if it has parameters, all the parameters have default values.
Scope resolution operator (def'n)
Permits a program to reference an identifier in the global scopethat has been hidden by another identifier with the same name in the localscope.
What is the differencebetween Objectand Instance?
An instance of a user-defined type is called an object. We can instantiatemanyobjects from oneclass.
An object is an instance of a class.
What is the differencebetween macroand inline?
Inline follows strict parameter type checking, macros do not.
Macros are alwaysexpanded by preprocessor, whereas compilermay or may notreplace the inline definitions.
What is multiple inheritance?
One thing Java or C# cannot do. A class can inheritpropertiesfrom more thanoneclass
What is meant byreference variable in C++?
Provides an aliasto a previouslydefinedvariable.
Data -type & reference-name = variable name
Iterator class (def'n)
Provides an access to the classwhich are inside the containers(it holds a group of objects in an organized way).
Smart Pointers (def'n)
Similar to pointers with additional features such as:
1) Automaticdestruction of a variable when it becomes out of scope.
2)Throwing of exceptions that ensures the proper destruction of the dynamicallyallocatedobjects.
(Function Overloading)Can a function be overloadedbased on return types?
Function signaturedoes not depend on the return type. So overloadingcannot be resolved by the return type alone.
Virtual Function (def'n)
A member function that is declaredwithin a baseclass and redefinedby a derived class.
To create one the function declaration in the base class is preceded by the keyword virtual.