LANGUAGES | C | C LANGUAGE INTERVIEW QUESTION AND ANSWERS | 03

What is message passing - What is a structure

C Language Interview Question and Answers:

11. What is message passing?
                An object oriented program consists of a set of objects that communicate with each other. Message passing involves specifying the name of the object, the name of the function and the information to be sent.

12. What is the use of default constructor?
                A constructors that accepts no parameters is called the default constructor.If no user-defined constructor exists for a class A and one is needed, the compiler implicitly declares a default parameterless constructor A::A(). This constructor is an inline public member of its class. The compiler will implicitly define A::A() when the compiler uses this constructor to create an object of type A. The constructor will have no constructor initializer and a null body.

13. Define destuctors?
                A destructor is called for a class object when that object passes out of scope or is explicitly deleted.A destructors as the name implies is used to destroy the objects that have been created by a constructors.Like a constructor , the destructor is a member function whose name is the same as the class name but is precided by a tilde.

14. Define Constructors?
                A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class.

15. What is a structure?
                Structure constitutes a super data type which represents several different data types in a single unit. A structure can be initialized if it is static or global.

No comments:

Post a Comment