-
Inheritance
Which one of the following statements regarding C++ class inheritance is FALSE? a. Inheritance promotes generic design and code reuse.b. Struct cannot be inherited in C++. c. C++ supports multiple inheritance. d. Inheritance is a mechanism through which a subclass inherits the properties and behavior of its superclass.
-
-
What are virtual functions?
A virtual function allows derived classes to replace the implementation provided by the base class. The compiler makes sure the replacement is always called whenever the object in question is actually of the derived class, even if the object is accessed by a base pointer rather than a derived pointer. This allows algorithms in the base class to be replaced in the derived class, even if users don't...
-
What is friend function?
As the name suggests, the function acts as a friend to a class. As a friend of a class, it can access its private and protected members. A friend function is not a member of the class. But it must be listed in the class definition.
-
What is public, protected, private?
Public, protected and private are three access specifiers in C++. 1. Public data members and member functions are accessible outside the class.2. Protected data members and member functions are only available to derived classes.3. Private data members and member functions can’t be accessed outside the class. However there is an exception can be using friend classes.
-
What is an object?
Object is a software bundle of variables and related methods. Objects have state and behavior.
-
What is a class?
Class is a user-defined data type in C++. It can be created to solve a particular kind of problem. After creation the user need not know the specifics of the working of a class.