Difference between revisions of "Abstract - Virtual - Static"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "<h2>Static</h2> The "static" modifier means that a class cannot be instantiated, and the subroutines must instead be called directly. <h2>Abstraction</h2> The "abstract" modi...")
 
Line 1: Line 1:
 
<h2>Static</h2>
 
<h2>Static</h2>
 
The "static" modifier means that a class cannot be instantiated, and the subroutines must instead be called directly.
 
The "static" modifier means that a class cannot be instantiated, and the subroutines must instead be called directly.
 +
 +
if you had a class of human and created an instance of the human called wayne, the static modifier doesn't allow access such as wayne.example() , or wayne.example = 5, or Console.WriteLine(wayne.example). They are not avialable in an instance of a class.
  
 
<h2>Abstraction</h2>
 
<h2>Abstraction</h2>

Revision as of 20:09, 16 December 2016

Static

The "static" modifier means that a class cannot be instantiated, and the subroutines must instead be called directly.

if you had a class of human and created an instance of the human called wayne, the static modifier doesn't allow access such as wayne.example() , or wayne.example = 5, or Console.WriteLine(wayne.example). They are not avialable in an instance of a class.

Abstraction

The "abstract" modifier when declaring a class means that the class contains one or more abstract subroutine, and must have one or more subclasses for implementations of abstract methods. A subclass of an abstract class that is instantiated must implement any abstract subroutines contained in the abstract class.

Virtual

A virtual method is one which is inheritable and can be overridden.