Oop Definitions Flashcards
What is encapsulation?
Group of related properties, methods and other members are treated as a single unit or object.
The process of defining a class by concealing its internal members from outside the class and accessing those internal data members only through public methods or definitions.
Private, public, protected.
What is inheritance?
Describes the ability to create new child classes based on an existing base class.
The new class inherits the visible properties and methods and events of a base class.
Base methods can be redesigned in the derived class which is known as overriding.
Multiple inheritance is not available but can implement interfaces to overcome this.
What is polymorphism?
Means that you can have multiple classes derived from a base class that can be used interchangeably, even though each class implements the same properties or methods in different ways.
It lets you use items with the same names through late-binding.
How does overloading use inheritance in classes?
Can use the same method name multiple times.
The passed arguments changed
How does encapsulation use inheritance?
Modifiers- private, protected, public
How does overriding implement inheritance?
Use of ‘new’ word in derived class method of same name.
Derived classes can modify functionality of an inherited method.
Three advantages of inheritance?
Reusability of code.
Testing required for derived class only.
Greater reliability of structure.
Give three advantages of methods?
Reuse of code.
Structured design to simplify code.
Development time improved.
What is instantiation?
The creation of an object
What is a child class?
A class which inherits the visible properties, methods and events of the base class and can be customised with additional properties, methods, and extends.
What is late binding?
The connection by a polymorphic base object to an overriding method during runtime when the object type is known.
What is overloading?
Same name, different signatures, return types may differ.
An example showing names and signatures.
What is an interface?
Abstract, facilitates multiple inheritance, no implementation code.
IComparable
Describe one other condition where a method is exited
An anticipated illegal or invalid operation is attempted and an Exception is thrown.
A return statement is reached and a value is returned to the calling program.-
The value must conform to the return type given in the method header.
What is an object?
Instance of a class.
An object will contain all the attributes, properties and methods of the class it is created from.
Many objects can be created from the same class.
What is a constructor?
A type of method within a class which is executed when an instance of the class is created.
What is a virtual method?
A method with an implementation that can be overridden by a child class.