Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 145 - 146 of 354

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 145

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What is a class?

Explanation

Understanding of Different Level, Class and Files
  • Class is an object oriented programming concept.
  • Provides user defined data type, which holds data members and member functions.
  • It can accessed and used by creating an instance of that class.
  • A class is like blueprint for an object.
  • For example, consider the class of cars.
  • There may be many cars with different names and brand but all of them will shared common properties like 4 wheels, speed limit, mileage range etc.
  • The member functions determine the behaviour of the class- support operations on data held in the objects of the class.

Definition of a class:

Class class_name

{

Data Member;

Method;

}

Class member:

Data and functions are members.

Question 146

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What is a Null object?

Explanation

  • An object of some class whose purpose is to indicate that a real object of that class does not exist.
  • One common use for a null object is a return value from a member function that is supposed to return an object with some specified properties but cannot find such an object.
  • In object-oriented computer programming, a Null Object is an object with no referenced value or with defined neutral behavior.
  • The Null Object design pattern describes the uses of such objects and their behavior (or lack thereof) .
Define the Null Object Synopsis, Context and Forces

Developed by: