Set - 4

Question 16 :

What is an accessor?

Answer :

An accessor is a class operation that does not modify the state of an object. The accessor functions need to be declared as const operations


Question 17 :

Differentiate between a template class and class template ?

Answer :

Template class: A generic definition or a parameterized class not instantiated until the client provides the needed information. It's jargon for plain templates. Class template: A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It's jargon for plain classes.


Question 18 :

When does a name clash occur?

Answer :

A name clash occurs when a name is defined in more than one place. For example., two different class libraries could give two different classes the same name. If you try to use many class libraries at the same time, there is a fair chance that you will be unable to compile or link the program because of name clashes.


Question 19 :

Define namespace?

Answer :

It is a feature in C++ to minimize name collisions in the global name space. This namespace keyword assigns a distinct name to a library that allows other libraries to use the same identifier names without creating any name collisions. Furthermore, the compiler uses the namespace signature for differentiating the definitions.


Question 20 :

What is the use of 'using' declaration. ?

Answer :

A using declaration makes it possible to use a name from a namespace without the scope operator.