Oop Flashcards
What is OOPS?
OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
Write basic concepts of OOPS
Abstraction.
Encapsulation.
Inheritance.
Polymorphism.
What is a class?
A class is simply a representation of a type of object. It is the blueprint/ plan/ template that describe the details of an object.
What is an object?
Object is termed as an instance of a class, and it has its own state, behavior and identity.
What is Encapsulation?
Encapsulation is an attribute of an object, and it contains all data which is hidden. That hidden data can be restricted to the members of that class.
Levels are Public,Protected, Private, Internal and Protected Internal.
What is Polymorphism?
polymorphism (from the Greek meaning “having multiple forms”) is the characteristic of being able to assign a different meaning or usage to something in different contexts - specifically, to allow an entity such as a variable, a function, or an object to have more than one form. There are several different kinds of polymorphism.
What is Inheritance?
The ability have a parent class give a child access to functions and variables
Define a constructor?
A method used to initialize a class, it has no return type and has the name of the class
Define Destructor?
A method is called when an object goes out of scope
What is a virtual class
A class than can be overridden
What is function overloading?
The ability to define functions with the same name but a different number of arguments and argument types. The function may also have a different return type but a different return type alone is not enough to make an overloaded function.
What is function overriding?
Function overriding is when a child class implements a function of a parent class replacing the functionality of the parent function
What is an abstract class?
An abstract class is a class that can’t be instantiated but can be inherited from. It can have both declared and implemented functions
What is a ternary operator?
The ternary operator is an operator that takes three arguments. The first argument is a comparison argument, the second is the result upon a true comparison, and the third is the result upon a false comparison
Bool ? AnswerIfTrue : AnswerIfFalse
What is the finalize method
The finalize method is a destructor. It can’t be called explicitly but is used by the garbage collector.