Share your knowledge at the LQ Wiki.
Go Back > Blogs > TheIndependentAquarius
User Name



Understanding RAII (Resource Acquisition Is Initialization) - C++

Posted 06-14-2012 at 01:45 AM by TheIndependentAquarius
Updated 10-09-2012 at 02:44 AM by TheIndependentAquarius

  • Q: What is an exception safe code?
    A: A code may throw an exception but at the same time if it:
    • Doesn't allow any memory (allocated by it) to be leaked.
    • Lets the program to remain in a well-defined state (no dangling pointers
      and all) so that execution can continue as intended.
    • Reports the error to the caller (when encountered).
    then it can be termed as an exception safe code.

    Of course, a code which won't be throwing any exception ever is an exception
Senior Member
Views 1555 Comments 0 TheIndependentAquarius is offline

this pointer - C++

Posted 03-13-2012 at 11:10 AM by TheIndependentAquarius
Updated 03-13-2012 at 10:25 PM by TheIndependentAquarius

The this pointer is a hidden pointer inside every class's non-static function which points to the class's particular object through which the concerned function is called.
class A
        int rollNumber;

	A (int rollNum)
	    rollNumber = rollNum;

	void setRollNumber (int rollNum)
	    rollNumber = rollNum;
Senior Member
Posted in Pointers, C++
Views 1515 Comments 0 TheIndependentAquarius is offline

What is: Abstract base class, and Pure Virtual function - C++

Posted 11-21-2011 at 04:42 AM by TheIndependentAquarius
Updated 01-10-2012 at 08:17 AM by TheIndependentAquarius

  • In the cases where the derived classes may share the common functionality
    but with altogether "different" definitions, it makes sense to force the
    developers to create their own definitions for those common functions in
    concerned derived classes.
    This can be achieved by making the class "abstract".
  • A class is called an "abstract" class when it contains at least one "pure
    " function.
  • A "pure virtual
Senior Member
Views 2158 Comments 0 TheIndependentAquarius is offline

Object oriented programming - Objects and Classes [C++]

Posted 11-15-2011 at 03:02 AM by TheIndependentAquarius
Updated 06-12-2013 at 12:31 PM by TheIndependentAquarius

Object oriented programming is all about representing the parts of
the problem statements as `objects` and having them interact with
each other (by calling function(s) of the object in question).

Every object has a type. The type of an object is often called a
`class` in object oriented programming. The class contains the list
of characteristics of the object and the functions which the object
is capable of performing.
We can have many...
Senior Member
Posted in The basics, C++
Views 1758 Comments 1 TheIndependentAquarius is offline


All times are GMT -5. The time now is 11:13 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration