Horje
kotlin inheritance super Code Example
kotlin inheritance super
/*The super keyword refers to superclass (parent) objects. It is used to call
superclass methods, and to access the superclass constructor.*/

// take for example an activity in an andriod application.

class MainActivity : AppCompatActivity() {
  
 override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
 //super is used inside the method onCreate of the class MainActivity, so it
// refers to the MainActivity

//Here while overriding the MainActivity.onCreate(),
//super.onCreate(savedInstanceState) calls 
// the predefined MainActivity.onCreate().Then setContentView(R.layout.activity_main)
//is added to what the onCreate method does.


/* we went from the onCreate method being the onCreate method 
to it being the onCreate method + setContentView(R.layout.activity_main)
*/
 




Kotlin

Related
kotlin codeforces template Code Example kotlin codeforces template Code Example
kotlin filter map by value Code Example kotlin filter map by value Code Example
kotlin collection to linked list Code Example kotlin collection to linked list Code Example
setOnLongClick in android kotlin Code Example setOnLongClick in android kotlin Code Example
kotlin unsigned int Code Example kotlin unsigned int Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7