Multiple inheritance example in C++
It is possible to derive a new class from more than one base class. This is called Multiple Inheritance. To derive from more than the base class, you separate each base class by co
Read tutorialTHE TUTORIAL LIBRARY
It is possible to derive a new class from more than one base class. This is called Multiple Inheritance. To derive from more than the base class, you separate each base class by co
Read tutorialJust as an array name is a constant pointer to the first element of the array, a function name is a constant pointer to the function. It is possible to declare a pointer variable t
Read tutorialMany operating systems, such as DOS and UNIX, enable the user to pass parameters to your program when the program starts. These are called command-line options, and are typically s
Read tutorialTo open the file myfile.cpp with an ofstream object, declare an instance of an ofstream object and pass in the filename as a parameter:
Read tutorialNormally cout fills the empty field created by a call to width() with spaces, as shown above. At times you may want to fill the area with other characters, such as asterisks. To do
Read tutorialThe default width of your output will be just enough space to print the number, character, or string in the output buffer. You can change this by using width(). Because width() is
Read tutorialThe input object cin has two additional methods that can come in rather handy: peek(), which looks at but does not extract the next character, and putback(), which inserts a charac
Read tutorialAt times you want to ignore the remaining characters on a line until you hit either end of line (EOL) or end of file (EOF). The member function ignore() serves this purpose. ignore
Read tutorialThe global object cin is responsible for input and is made available to your program when you include iostream.h. In most of the examples in this site, you used the overloaded extr
Read tutorialIn addition to asserting that something is true using the assert() macro, you may want to print the current value of pointers, variables, and strings. This can be very helpful in c
Read tutorialIt is important to note that assert() is not intended to handle runtime error conditions such as bad data, out-of-memory conditions, unable to open file, and so forth. assert() is
Read tutorialMany compilers offer an assert() macro. The assert() macro returns TRUE if its parameter evaluates TRUE and takes some kind of action if it evaluates FALSE. Many compilers will abo
Read tutorialOne example today. A better developer tomorrow.