Basic concepts in OOP Flashcards
What is object oriented programming ?
A method of programming based on hierarchy of classes with well defined and cooperating objects
OR
A language model organized around objects
OR
A schematic paradigm for programming in which the linear concepts of procedures and tasks are replaced by the concepts of objects and message passing.
What is an object ?
An object is an executable copy of a class.
OR
It can be referred to as a new instance
What are the characteristics of objects ?
State
Behavior
How do you create an object ?
Create a class Create a constructor Create the object
How does an object store its states
In fields
How does an an object expose its behavior
through methods
How do objects communicate?
through methods that operate on an objects internal state.
What is a class?
A blueprint from which then individual objects can be created. OR A class is a structure that defines the data and the methods to work on that data
What is the syntax of class
class CLASSNAME{ // constructor( ) { } // Object }
What is a package
A namespace that organizes a set of related classes and interfaces.
What is an encapsulation
The concept that enables the hiding unnecessary details in classes and only providing a clear and simple interface for working with them.
What is inheritance?
This is a concept in OOP that enables new objects to take on the properties of existing objects.
What is a subclass/derived class?
A class that inherits from a superclass.
What is the base or superclass?
A class that is used as the basis for inheritance.
Example
class Student { int studentID; String emailAddress; String name; String sex; Date D.O.B; string course; } class UndergraduateStudent extends Student{ String mentor; string degreeCourse; int numberOfMajors;