Abstract class is class having atleast one pure virtual function.
Yes, we can create an object of the Base class.
If we make a class as abstract then we can't create an object of that class.
we can create only pointer of that class this is because to provide one interface to access and so that runtime time polymorphism can implement.
1.Why do we need encapsulation?2. What is a class in C++ analogous to in C
WELL DESIGNED MODULES ALWAYS HIDES ALL OF ITS IMPLEMENTAIONS DETAILS. MODULES THEN COMMUNICATE WITH EACH OTHER ONLY THROUGH API's UNKNOW TO EACH OTHER INNER IMPLEMENTATIONSPROPER USE OF ACCESS MODIFIE...
In order to bind the data and functions working on it and to safegaurd our data and funtcions from outside access (access from the other objects) we need Encaptulations.
What is the difference between encapsulation and datahiding.Explain with example
encapsulation is the wrapping up of data members and data functions into a single unit like classes. here we can control the visibility of data with the help of access specifiers i.e. public,private and protected.
in data hiding data is totally private we cannot access the data.
encapsulation is the concept of the datamember. Data Hiding is the Access Specifier.
Explain the inheritance principle
Inheritance is the process by which one object acquires the properties of another object.
Inheritance is one of the important principles of OOP.Inheritance is the process by which one object acquires the properties of another object.By use of Inheritance , an object need only define those ...
Inheritance involves building upon an existing class so that additional or more-specialised functionality is added.
A key design aspect of inheritance is that it is used in a manner which is understandable and supported by a clear, justifiable relationship.
Explain the encapsulation principle
Encapsulation is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed...
Every program deals with two elements:
1) Data
2) Code [function]
Combining these two elements into a single unit is known as Encapsulation (Binding).
Encapsulation with a simple example would be .Automatic Transmission on an automobile. It encapsulates 100's of bits of information about your engine, such as how much are accelerating, the pitch ...
Describe the principles of OOPS
There are three main principals of OOPS which are called polymorphism, inheritance and encapsulation
Abstraction: Involves extracting only the relevant information.Encapsulation: Involves packaging one or more components together.Inheritance: Is a process of creating a new class by adding some featur...
The four basic principle of OOP are:AbstractionEncapsulationHierarchyand ModularityPlease note that there are many other object oriented principles, but the above the are basic ones.We can refer Class...
When an instance variable is declared as transient, then its value need not persistwhen an object is stored.
Hi,This is srinivas from geektalk.When we need not to be serialized an object then we go for object to be declared as transient. this is the real time situation we need to use transient.when we use DT...