LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Blogs > TheIndependentAquarius
User Name
Password

Notices

C++
Old

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

Posted 06-14-2012 at 02:45 AM by TheIndependentAquarius
Updated 10-09-2012 at 03: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 1131 Comments 0 TheIndependentAquarius is offline
Old

this pointer - C++

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

Quote:
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.
Example:
Code:
class A
{
    private:
        int rollNumber;

    public:
	A (int rollNum)
	{
	    rollNumber = rollNum;
	}

	void setRollNumber (int rollNum)
	{
	    rollNumber = rollNum;
	}
};
...
Senior Member
Posted in C++, Pointers
Views 874 Comments 0 TheIndependentAquarius is offline
Old

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

Posted 11-21-2011 at 05:42 AM by TheIndependentAquarius
Updated 01-10-2012 at 09: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
    virtual
    " function.
  • A "pure virtual
...
Senior Member
Views 961 Comments 0 TheIndependentAquarius is offline
Old

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

Posted 11-15-2011 at 04:02 AM by TheIndependentAquarius
Updated 06-12-2013 at 01: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 C++, The basics
Views 1409 Comments 1 TheIndependentAquarius is offline

  



All times are GMT -5. The time now is 11:40 AM.

Main Menu
Advertisement

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