DISHA NIRDESHAN

Enlightens your career

Tuesday, June 21, 2011

Difference among various concepts

 Major Differences Between C And C++                                         C                                     C++ C follows the procedural programming paradigm C++ is a multi-paradigm language(procedural as well as object oriented)   In case of C, importance is given to the steps or procedure of the program C++ focuses on the data rather than the...

Other Concepts

Other Concepts: What is an Object? What is Object Oriented Programming? Object represents/resembles a Physical/real entity. An object is simply something you can give a name. Object Oriented Programming is a Style of programming that represents a program as a system of objects and enables code-reuse.   What are C++ storage classes? auto:the default. Variables are automatically created and initialized when they are defined and are destroyed at the end of the block containing their definition(when they are out of scope). They are not visible  outside that block         auto int a;          int b; Both are same statement. auto is default register: a type of auto variable. a suggestion to the compiler...

Questions on Exceptional handling & polymorphism

  EXCEPTION HANDLING: What is an Exceptional Handling? An exception is a hardware generated condition which is triggered when processing fails for some reason in a CPU. It could be caused by dividing by zero or trying to access memory at a nonexistent address The exception handling mechanism is made up of the following elements:   ü try blocks ü catch blocks ü throw expressions ü Exception specifications (C++ only)   The benefits of Exception Handling are: 1. Program is not terminated abruptly 2. User will understand what errors are occurring in the program. The three keywords for Exception Handling are: Try, Catch and Throw. The program tries to do something. If it encounters some problem, it throws an exception to another program block which catches the...

Questions on Inheritance

INHERITANCE What is inheritance, explain with an example? Inheritance is a mechanism of reusing and extending existing classes without modifying them, thus producing hierarchical relationships between them #include <iostream> using namespace std; class BaseClass {   int i; public:   void setInt(int n);   int getInt(); }; class DerivedClass : public BaseClass {   int j; public:   void setJ(int n);   int mul(); }; void BaseClass::setInt(int n) {   i = n; } int BaseClass::getInt() {   return i; } void DerivedClass::setJ(int n) {   j = n; } int DerivedClass::mul()...

Questions on Constructors

  CONSTRUCTORS QUESTIONS     What is a constructor?  A constructor allocates space for an object and initializes it. Constructors always have the same name as their class. A class may have more than one constructor. Or Constructors allow initialization of objects at the time of their creation. Constructor function is a special function that is a member of the class and has same name as that of the class. An object's constructor is automatically called whenever the object is created (statically or dynamically). Constructors are always public. They are used to make initializations at the time of object creation.   What is Destructors? Destructors are usually used to deallocate memory and do other cleanup for a class object and its class members when the...