Sie sind auf Seite 1von 2

1.What is difference between initialization and assignment?

2.What is the difference between Class and Structure?


structure :- Structure have a by default public.
In class have a by default private.
• Structure cannot be inherited. But class can be inherit.
• There is no data hiding features comes with structures. Classes do,
private, protected and public.
• A structure can't be abstract, a class can.
• A structure is a value type, while a class is a reference type.
• A structure is contain only data member , but class contain data
member and member function.
• In a Structure we can't initilse the value to the variable but in
class variable we assign the values.
• Structure are value type, They are stored as a stack on memory.
where as class are reference type. They are stored as heap on
memory.
3.What are the differences between public, private, and protected access?
• public is used for global access that is its scope is not
only within the class but also outside the class.

• private is used only in the class class in which it is


defined.It cannot be accessible by its derived members.

• protected is used within the class in which it is defined


and derived members of it can also access it.
4. When to use Multiple Inheritance?
Inheritance is a method which means objects of one class get the
properties of objects of another class. in this we have 5 types of inheritance
multiple inheritance means deriving a class from two or more base classes.

5.What is namespace?
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.
6.What is the difference between object and a class?

A Class is a template. An object is an instance of class. Every data member of an object


contains its own value, where as Class only declares the data members.

7. What is Encapsulation?

Wrapping up of a data and function into single unit is called as Encapsulation


8.What is abstraction?

Abstraction is of the process of hiding unwanted details from the user.

9.