-
Invoke the virtual toString() function
To invoke the virtual toString() function defined in GeometricObject from a Circle object c, use :A. ((GeometricObject*)c)->toString();B. c.super.toString()C. (GeometricObject*)c->toString();D. c->GeometricObject::toString()
-
Placement New Syntax
How can a C++ developer use the placement new syntax to make new allocate an object of class SomeClass at a particular memory address stored in a pointer type variable named pmem?A. new SomeClass(pmem);B. new(pmem) SomeClass;C. new SomeClass pmem;D. new pmem SomeClass;E. new (pmem, SomeClass);
-
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 do you mean by pure virtual functions?
A pure virtual member function is a member function that the base class forces derived classes to provide. Normally these member functions have no implementation. Pure virtual functions are equated to zero. class Shape { public: virtual void draw() = 0; };
-
What is the difference between class and structure?
Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also. The major difference is that all declarations inside a structure are by default public. Class: Class is a successor of Structure. By default all the members inside the class are private.