OOP
OOP
OOP
Class helps in code reusability. Encapsulation is wrapping up variables and methods in class. It
helps in data hiding. Polymorphism means having different forms. In class method may behave
differently depending on the inputs / function overloading. Inheritance means property of a child
class to inherit the characteristic of a parent class. Abstraction means hiding complicated things
from the user. These are the powerful features pillars ( սյուն)of OOP.
Questions
What’s the difference between C and C++?
1.The first point is C is a procedural or structural programming language. While C++ is procedural &
OOP language.
2.C++ is OOP- class, objects-easy to relate with external world & solving problems.
3.C++ is more secure that C, because it offers security features such as data hiding and
encapsulation. We have access specifiers ( public, private, protected) so that we can control that
what we want to expose (բացահայտել) publicly and what we want to keep private.
4.C++ provides characteristics like inheritance, abstraction, polymorphism, encapsulation, operator
overloading, constructors and many more.
5.C++ is a generic programming language, it’s possible with the help of STL. This library provides
templates.
What is namespace in C++?
If there are two or more functions with the same name defined in different libraries then how will
the compiler know which one to refer to. Hence, we put those functions, class, objects under a
name.
What is using namespace std in C++?
Namespace is nothing but a function. It tells the compiler that you will be making use of the name
space called std. And you want to use all those functions/ classes/ objects under “std”. So that you
don’t need to write std::cout, you can simply write cout , you can directly use the name of
associated function.