C++ Part2

What is your reaction to this line of code?
delete this;
It is not a good programming Practice.
A good programmer will insist that you should absolutely never use the statement if the class is to be used by other programmers and instantiated as static, extern, or automatic objects. That much should be obvious.
The code has two built-in pitfalls. First, if it executes in a member function for an extern, static, or automatic object, the program will probably crash as soon as the delete statement executes. There is no portable way for an object to tell that it was instantiated on the heap, so the class cannot assert that its object is properly instantiated. Second, when an object commits suicide this way, the using program might not know about its demise. As far as the instantiating program is concerned, the object remains in scope and continues to exist even though the object did itself in. Subsequent dereferencing of the baller can and usually does lead to disaster. I think that the language rules should disallow the idiom, but that’s another matter.

What is the difference between a copy constructor and an overloaded assignment operator?

A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class.

When should you use multiple inheritance?

There are three acceptable answers:- “Never,” “Rarely,” and “When the problem domain cannot be accurately modeled any other way.”

Consider an Asset class, Building class, Vehicle class, and CompanyCar class. All company cars are vehicles. Some company cars are assets because the organizations own them. Others might be leased. Not all assets are vehicles. Money accounts are assets. Real estate holdings are assets. Some real estate holdings are buildings. Not all buildings are assets. Ad infinitum. When you diagram these relationships, it becomes apparent that multiple inheritance is a likely and intuitive way to model this common problem domain. The applicant should understand, however, that multiple inheritance, like a chainsaw, is a useful tool that has its perils, needs respect, and is best avoided except when nothing else will do.

What is a virtual destructor?

The simple answer is that a virtual destructor is one that is declared with the virtual attribute.
The behavior of a virtual destructor is what is important. If you destroy an object through a baller or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not be comple

Can a constructor throw a exception? How to handle the error when the constructor fails?

The constructor never throws a error.

What are the debugging methods you use when came across a problem?

Debugging with tools like :

GDB, DBG, Forte, Visual Studio.

Analyzing the Core dump.

Using tusc to trace the last system call before crash.

Putting Debug statements in the program source code.

How the compilers arranges the various sections in the executable image?

The executable had following sections:-

Data Section (uninitialized data variable section, initialized data variable section )

Code Section

Remember that all static variables are allocated in the initialized variable section.


GPRS – General Packet Radio Service

General Packet Radio Service (GPRS) is a data service designed for second generation GSM and PCS networks. It uses a packet radio principle to carry end user’s packet data protocol like IP or X.25 information from mobiles to external packet data networks and visa versa. GPRS optimises the use of radio and network resources. Separation between the base station subsystem and network subsystem is maintained and the network subsystem can be reused with other services. GPRS radio channel reservation and allocation is done flexible from 1 to 8 radio interface timeslots per TDMA frame and timeslots are shared by all the active users. Up and downlink are allocated separately. The radio interface resources are shared dynamically between data and speech services according to operator’s preference and base station load.

Several radio channel coding schemes are specified to allow data rates from 9 kbits/s up to 171 kbits/s and eventually 384 kbits/s per user. The available bandwidth per channel depends upon which coding scheme is used. CS1 provides connectivity under “all conditions” and delivers a user throughput of up to 9.05 kbits/s, While CS4 requires excellent radio signal (Carrier to Interference ration of 27 dB) and delivers a user throughput of up to 21.4 kbits/s.

GPRS is designed to support intermittent and bursty data transfers and occasional transmission of large volumes of data, and point-to-point and point-to-multipoint services are also supported. GSM network requires two new network elements for GPRS. The Serving GPRS Support Node (SGSN), which performs security functions, mobility management and access control. Frame Relay connects the SGSN the base station system. The Gateway GSN (GGSN) is used for interworking with external packet-switched networks. GPRS is standardised in ETSI (European Telecommunications Standards Institute).

The Hot C++ Interview Question Asked

The Hot C++ Interview Question: 

How do you rank your C++ skills on a scale of 1 to 10?

This is often the first question you will hear on an interview for a C++ contract. You will be tempted to rate yourself high, and you should. This is your chance to convince the client that you are just what he is looking for–an assertive and knowledgeable professional who will be productive either working on a team or on your own. Naturally, though, you should be able to support the ranking you gave yourself by doing well on the interview.

Q1. Is there anything you can do in C++ that you cannot do in C?

A1. No. There is nothing you can do in C++ that you cannot do in C. After all you can write a C++ compiler in C.

Q2. What is the difference between C++ structure and C++ class?

A2. The default access level assigned to members of struct is public while the default access level assigned to a class is private.

Q3. What is encapsulation? A3. Encapsulation is welding of code and data together into objects.

Q4. What is inheritance?

A4. Inheritance is a mechanism through which a subclass inherits the properties and behavior of its superclass.

Q5. What is polymorphism?

A5. In Greek this means “many shapes.” As a consequence of inheritance and virtual functions, a single task (for example, drawing a geometrical shape) can be implemented using the same name (like draw()) and implemented differently (via virtual functions) as each type in object hierarchy requires(circle.draw() or rectangle.draw()). Later, when a polymorphic object (whose type is not known at compile time) executes the draw() virtual function, the correct implementation is chosen and executed at run time.

Q6. What would you say if you saw “delete this” while reviewing your peer’s code?

A6. You should never do this. Since compiler does not know whether the object was allocated on the stack or on the heap, “delete this” could cause a disaster.

Q7. What is the difference between public, protected, and private members of a class?

A7. Private members are accessible only by members and friends of the class. Protected members are accessible by members and friends of the class and by members and friends of derived classes. Public members are accessible by everyone.

Q8. What is the difference between non-virtual and virtual functions?

A8. The behavior of a non-virtual function is known at compile time while the behavior of a virtual function is not known until the run time.

Q9. What is a pure virtual function?

A9. “A pure virtual function is a function declared in a base class that has no definition relative to the base.”

Q10. What is an abstract base class?

A10. It is a class that has one or more pure virtual functions.

Hindi Shayari – Honth keh nahi sakte jo fasana dil ka…

Honth keh nahi sakte jo fasana dil ka,
Shayad nazar se woh baat ho jaye.
Is umeed mein karte hain intezaar raat ka,
ke shayad sapne mein mulaqat ho jaye

Na kabhi muskurahat tere hothon se duur ho..
Teri har khwahish haqiqat ko manzoor ho..
Ho jaye jo tu mujhse khafa..
Khuda na kare mujhse kabhi aisa kasoor ho..

Fursat kise hai ruthne-manane ki;
Nigahe badal gai apne aur begane ki.
Aap na chhodna Haath hamara,
Varna tamanna na rah jayegi phir dil lagane ki. 

Tab tak pyar se pyar mat karo,
jab tak pyar aapse pyar na kare,
aur agar pyar aapse pyar kare to,
use aaisa pyar karo ki pyar kisi aur se pyar na kare”


Your eyes won’t let my thoughts go back to sleep.

 Your eyes won’t let my thoughts go back to sleep.

Your eyes won’t let my thoughts go back to sleep.
Your words draw me across 2000 miles.
I don’t know you at all, and yet I know
You better than my friends of many years.

The days I spent with you are like a tape
I play, rewind, play, rewind, and play.
Whenever I remember something new,
I feel as though you touched me on the cheek.

I miss you as the grass awaits the wind,
Or as the morning sky awaits the sun.
Although I look for you in every doorway,
I find only the darkness in my heart.

Music: The Bad Girl’s Lament
Sequenced by 
Barry Taylor

Download Interactive Voice Call Master for Mobile

All-in-one, easy-to-use incoming call control solutionFirst you can define un-limited profiles to meet you demands in any situation. In a profile, you can divide incoming callers up to seven groups: callers on five lists or phonebook (you have to define the list in advance), callers not on all above, and hidden callers (those who conceal phone number). IVCM will respond each group by one of following responses accordingly:

  • Accept
  • IVR (Interactive Voice Response)
  • Send busy tone
  • Reject + send the SMS texts that you defined
  • Divert calls to (implemented by call diversion)
  • Record conversation
  • Mute the ringer

Download to Mobile: Open with your mobile -> Quick Download -> enter Quick Download Code 4286
Interactive Voice Call Master: