Chapter #1 – Object Oriented Programming using C++

An item specified in terms of operations is called abstract data type.

A class is a piece of software that indicates data specification and functions operating on these data and possibly on the data belonging to class instances.

Pointers are variables leading to variables.

Dangling pointers (or wild pointers) in computer programming are pointers that do not point to a valid object of the appropriate type.

T o avoid the dangling pointers problem, always assign NULL to the pointer after deleting it (p = 0 or p = NULL). This is called NULL pointer (not p refers to NULL).

Always defines an explicit copy constructor when you’ve pointers in your class.

STL was developed by Alexander Stepanov and Meng Lee.

STL contains 3 types of generic entities: containers, iterators and algorithms.

A container is a data structure that holds some objects which are usually of the same type.

STL Containers: deque, list, map, multimap, set, multiset, stack, queue, priority_queue and vector.

An iterator is an object used to reference an element stored in a container (generalization of pointer).

No iterators are supported in stack, queue and priority_queue containers.

Check functional header to be used with STL algorithms.

reinterpret_cast is used to cast pointer objects where static_cast is used to cast usual objects. Check this article.

Advertisements

2 thoughts on “Chapter #1 – Object Oriented Programming using C++

  1. جزاك الله كل خير علي مشاركتك يا عبد الرحمن أنا دورت علي نقطه
    No iterators are supported in stack, queue and priority_queue containers
    بما أني مبتديء فلقيت تعريف لل
    stack, queue, priority_queue.
    أنهم مش
    Containers but Container Adapters

    وجزاك الله كل خير يا عبد الرحمن.

    reference :
    http://msdn.microsoft.com/en-us/library/1fe2x6kt%28VS.80%29.aspx

  2. Great info Feras! Thanks for your comment. It was very useful when I’ve known several types/categories of containers (Associative, Adapters and Sequence).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s