CSE 1322 Lecture Quiz 4 Review

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Can you instantiate an abstract class?

no

When inheriting a class,

our constructors must call the base class constructor, so that it can initialize its member variables.

A method, which can be overridden, is called

virtual

What is the difference between overloading and overriding methods?

overloading is when there are 2 methods with the same name but different parameters but overriding is when inherited methods are being redefined in another class

The class from which we inherit is referred to as

parent class or base class / super class

When a base class is inherited:

All of its public, protected and protected internal members (methods, properties, etc.) are visible to the inheriting class. - All of its private methods, properties and member-variables are not visible to the inheriting class. - All of its internal members are visible to the inheriting class, only if the base class and the inheriting class are in the same assembly (the same Visual Studio project).

The class with which inherit from the parent class is referred to as either one of these:

a derived class, a sub class, or child class

What is inheritance?

a fundamental principle of object-oriented programming. It allows a class to "inherit" (behavior or characteristics) of another, more general class and it allows a new class to "absorb" an existing class's members and it saves time by reusing proven and debugged high-quality software

Downcasting

casting a superclass to a subclass

The keyword protected internal:

defines class members which are both internal, i.e. visible within the entire assembly, and protected, i.e. not visible outside the assembly, but visible to classes who inherit it (even outside the assembly)

The keyword protected:

defines class members which are not visible to users of the class (those who initialize and use it), but are visible to all inheriting classes (descendants)

What does the keyword base indicate?

that the base class must be used allows access to its methods, constructors and member variables. Using base(), we can call the constructor of the base class. Using base.Method(...) we can invoke a method of the base class, pass parameters to it and use its results. Using base.field we can get the value of a member variable from the base class or assign a different one to it


Set pelajaran terkait

Chapter: Life insurance policy provisions, options, and riders

View Set

Psych Chapter 14 Psychological Disorders

View Set

Pre-Cal and Trigonometry Chapter 4

View Set