CrazyEngineers
  • C++ QUESTIONS

    • · What is a class?
    • · What is an object?
    • · What is the difference between an object and a class?
    • · What is the difference between class and structure?
    • · What is public, protected, private?
    • · What are virtual functions?
    • · What is friend function?
    • · What is a scope resolution operator?
    • · What do you mean by inheritance?
    • · What is abstraction?
    • · What is polymorphism? Explain with an example.
    • · What is encapsulation?
    • · What do you mean by binding of data and functions?
    • · What is function overloading and operator overloading?
    • · What is virtual class and friend class?
    • · What do you mean by inline function?
    • · What do you mean by public, private, protected and friendly?
    • · When is an object created and what is its lifetime?
    • · What do you mean by multiple inheritance and multilevel inheritance? Differentiate between them.
    • · Difference between realloc() and free?
    • · What is a template?
    • · What are the main differences between procedure oriented languages and object oriented languages?
    • · What is R T T I ?
    • · What are generic functions and generic classes?
    • · What is namespace?
    • · What is the difference between pass by reference and pass by value?
    • · Why do we use virtual functions?
    • · What do you mean by pure virtual functions?
    • · What are virtual classes?
    • · Does c++ support multilevel and multiple inheritance?
    • · What are the advantages of inheritance?
    • · When is a memory allocated to a class?
    • · What is the difference between declaration and definition?
    • · What is virtual constructors/destructors?
    • · In c++ there is only virtual destructors, no constructors. Why?
    • · What is late bound function call and early bound function call? Differentiate.
    • · How is exception handling carried out in c++?
    • · When will a constructor executed?
    • · What is Dynamic Polymorphism?
    • · Write a macro for swapping integers.
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Sahithi Pallavi

    MemberJul 10, 2011

    Encapsulation is the mechanism that binds together the code and the data it manipulates and keeps both safe from outside interference and misuse.

    Inheritance is the process of inheriting all the features from a class. The advantages of inheritance are reusability of code and accessibility of variables and methods of the super class by subclasses. So that the programmer can develop the subclasses so easily and Hence the Productivity of the Programmer and the Organisation will Increase.

    In POP, programming logic follows certain procedures and the instructions are executed one after another whereas in OOP program, unit of program is object, which is nothing but combination of data and code. And In procedural program, data is exposed to the whole program whereas in OOPs program, it is accessible with in the object and which in turn assures the security of the code.


    I will be happy if anyone correct me and anyone explain in detail with some examples if you can.
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorJul 11, 2011

    Dynamic Polymorphism:

    When an entity changes its form depending on the circumstances it is called as Dynamic Polymorphism.
    Polymorphism, as the word suggests, when we have more than one form.

    A function is said to exhibit dynamic polymorphism when calls to its various forms are resolved dynamically when the program is executed i.e. via 'late binding' i.e. at run-time instead of compile time.
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorJul 11, 2011

    RTTI : It stands for Run Time Type Information/Identification.

    It means the information about an object's data type is made available at run-time.
    This is a C++ implementation of a more generic concept called reflection or, more specifically, type introspection.

    The dynamic_cast<> operation and typeid operator in C++ are part of RTTI.
    Are you sure? This action cannot be undone.
    Cancel
  • Sahithi Pallavi

    MemberJul 11, 2011

    AbraKaDabra
    Dynamic Polymorphism:

    When an entity changes its form depending on the circumstances it is called as Dynamic Polymorphism.
    Polymorphism, as the word suggests, when we have more than one form.

    A function is said to exhibit dynamic polymorphism when calls to its various forms are resolved dynamically when the program is executed i.e. via 'late binding' i.e. at run-time instead of compile time.
    @Akd : Can you give me an example?
    Are you sure? This action cannot be undone.
    Cancel
  • Ankita Katdare

    AdministratorJul 11, 2011

    @sahithi: Yes.

    In C++, one way to get late binding is to use function pointers (a type of pointer that points to a function instead of a variable)
    The function that a function pointer points to can be called by using the function call operator (()) on the pointer.

    For e.g:

    int Add(int x, int y)
    {
        return x + y;
    }
    int main()
    {
    // Create a function pointer and make it point to the Add function
        int (*p)(int, int) = Add;
    cout << p(5, 3) << endl;
        return 0;
    }
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register