Inheritance and Memory Allocation
Question: I can’t create an instance of the derived class using operator new. The base and the derived classes differ only by a virtual function. The error messages I receive
Question: I can’t create an instance of the derived class using operator new. The base and the derived classes differ only by a virtual function. The error messages I receive
Question: I am a beginner with C++ programming. I was doing fine until I came to the string data type. Here is my problem: #include #include This gives me errors.
Question: How do you make the compiler generate an error when a variable is set to a value outide the range of the constrained type? For example; strong x; //strong
Question: Is there a problem with using the ?: operator instead of the if…else… construct? For example, see the following: if(iNum1 > iNum2) iNum3 = iNum1;else iNum3 = iNum2; The
Question: In Java using the java.lang.reflect classes, one can find out the name, class, and methods of an object simply by having a reference to that object. Is there a
Question: How can you caluculate interest using only integers and no double or floats? Answer: This question can be of interest for anyone who is confined to ineteger arithmetic. Many
Question: How do I pass a function as a parameter? Answer: First, let’s distinguish between a parameter and an argument. The parameter is the type of the object passed. An
Question: How can I declare a constant object that is actually constant? Answer: Here’s an example: const Date d; //create a const Date object Note that you can only invoke
Question: I’m trying to find information regarding anonymous unions in C++. I hear that in C++, one is able to declare a union such as: union example{ int a; int