C++ Part1

Is it possible to have Virtual Constructor? If yes, how?If not, Why not possible ?

There is nothing like Virtual Constructor.
The Constructor cant be virtual as the constructor is a code which is responsible for creating a instance of a class and it cant be delegated to any other object by virtual keyword means.

What about Virtual Destructor?

Yes there is a Virtual Destructor. A destructor can be virtual as it is possible as at runtime depending on the type of object baller is balling to , proper destructor will be called.

What is Pure Virtual Function? Why and when it is used ?

The abstract class whose pure virtual method has to be implemented by all the classes which derive on these. Otherwise it would result in a compilation error.
This construct should be used when one wants to ensure that all the derived classes implement the method defined as pure virtual in base class.

What is problem with Runtime type identification?

The run time type identification comes at a cost of performance penalty. Compiler maintains the class.

How Virtual functions call up is maintained?

Through Look up tables added by the compile to every class image. This also leads to performance penalty.

Can inline functions have a recursion?

Syntax wise It is allowed. But then the function is no longer Inline. As the compiler will never know how deep the recursion is at compilation time.

How do you link a C++ program to C functions?

By using the extern “C” linkage specification around the C function declarations.
Programmers should know about mangled function names and type-safe linkages. Then they should explain how the extern “C” linkage specification statement turns that feature off during compilation so that the linker properly links function calls to C functions.

Explain the scope resolution operator?

It permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.

How many ways are there to initialize an int with a constant?

1. int foo = 123;
2. int bar(123);

Posted in C/C++. 7 Comments »

7 Responses to “C++ Part1”

  1. old stone oven Says:

    Since then, I have been feasting on piping hot, delicious home cooked pizzas,
    which I have eaten whilst sitting on the beach at night.

    You might need to dust your rolling pin with flour
    too, if the crust sticks to it too much while you are rolling.
    Lay the dough on the tray or baking sheet, then dimple the
    dough until it’s a thick, flattened circle.

  2. Kinder) Says:

    Piece of writing writing is also a fun, if you be familiar with
    then you can write if not it is complex to write.

  3. Max Thermo Burn Says:

    I’m now not positive the place you’re getting your
    information, but good topic. I must spend a while learning more or understanding more.

    Thank you for wonderful info I used to be in search of this
    information for my mission.

  4. Max Thermo Burn Muscle Says:

    In fact no matter if someone doesn’t be aware of after that its up to other viewers that they will help, so here it occurs.

  5. Jess Says:

    I know this website provides quality depending posts and extra data, is there any other web page which provides such stuff in quality?

  6. Vimax Detox Says:

    This paragraph will assist the internet visitors for building up new blog or even a blog from start to

  7. Juicing Says:

    Hi, I do tink this is an excellent web site. Istumbledupon it
    😉 I will return once again since i have saved as a favorite it.

    Money and freedom is the besst way to change, may you be rich and
    continue to guide other people.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s


%d bloggers like this: