Question: What is Inheritance?
Answer: Ability of a new class to be created, from an existing class by extending it, is called inheritance.
Question: What is a base class?
Answer: When inheritance is used to create a new class from another, the new class is called the subclass or derived class, and the class from which it was derived is called the base class.
Question: What is a concrete class?
Answer: A concrete class is one that can be used to directly create, or instantiate objects, unlike an abstract base class which can only be used as a base class for other classes which eventually lead to concrete classes
Question: What are data members?
Answer: Objects are miniature programs, consisting of both code and data. The code consists of a series of member functions. The data items are called data members.
Question: What is a constructor?
Answer: Objects are complete, miniature programs and, like any good programs, have well defined initialization and termination phases. They have special routines (i.e. member functions ) to look after this. The initialization routine is called the constructor, and C++ ensures that every object is properly initialized by calling its constructor. The designer of the object can have more than one constructor, a situation called overloading and then the compiler will select between them depending on exactly what arguments are passed to the constructor function. However there must always be a default constructor, to be used when no information is supplied.
Question: What is a destructor?
Answer: The termination routine is called the destructor, and C++ will provide a default if none is supplied. If, during the lifetime of the object, it uses heap memory then the designer of the object must provide a destructor function to release such memory to avoid a memory leak.
Question: What is global variable?
Answer: Global variables can be accessed throughout a program. Another way to put this is to say they have global scope.
Question: What is local variable?
Answer: Local variables can only be accessed within the function, or more specifically the compound statement in which they are declared. Another way to put this is to say they have local scope.
Question: What is a null pointer?
Answer: A null pointer is a pointer that is currently pointing to nothing. Often pointers are set to zero to make them null pointers or tested against zero to see if they are null or not.
Question: What is a pointer?
Answer: A pointer is a variable that holds the address of another variable or object.
Question: What is meant by protected?
Answer: The protected keyword in the class statement means that the following members of the class are not available to users of the objects of the class, but can be used by any subclass that inherits from it, and consequently forms part of its implementation.
0 comments:
Post a Comment