devxlogo

Tip Bank

What is pure virtual function?

Question: Can you explain and give me examples of pure virtual function? What is the difference between pure virtual function and virtual function? Answer: A pure virtual function is a

Clearing character arrays

Question: How do you clear a character array? Answer: You can use the standard C library memset function. Here is an example:void foo (){ char t [20]; cin >> t;

Constructors and virtual functions

Question: I have been doing some programming in C++ and recently decided I would try some Windows programming with the Microsoft Foundation Classes. This isn’t a question about Windows but

What to do with overload arguments

Question: Which arguments do you receive when you overload . and -> , and what do you do with the arguments? I know that for overloading [] you receive the

Compilers: Which is best?

Question: Which model of C/C++ compiler offers the best value for a beginning programmer?(It must be ANSI C compatible.) Answer: The GNU G++ compiler. It’s free, ANSI C compatible and

File handles/pointers

Question: In C, I use the FILE *filename. As a beginning C++ programmer, I open streams for reading and writing inside the main() function, but when I try to work

Inheritance design

Question: Suppose I’ve got the following class hierarchies:Surface_PlotContourSurface_Plot, child of Surface_PlotSurface_DataGridSurface_Data, child of Surface_DataSurface_Plot contains a Surface_Data object, ContourSurface_Plot contains a GridSurface_Data object.What is the most elegant way to arrange