Skip to content

Instantly share code, notes, and snippets.

View josphatmwania's full-sized avatar
💭
Abducted by aliens!

Josphat Mwania josphatmwania

💭
Abducted by aliens!
View GitHub Profile
@josphatmwania
josphatmwania / GlassCounter.kt
Created January 27, 2024 18:46
GlassCounter
package com.josphat.stateapp.screens
import android.widget.Button
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@josphatmwania
josphatmwania / Assignment.kt
Last active June 22, 2023 09:16
Polymorphism and abstract class difference and their implementation
## The key idea behind polymorphism is that objects of different classes can be treated as objects of a common superclass or interface.
##This enables you to write code that can work with objects of different types, as long as they adhere to the defined interface or inheritance hierarchy.
## EXAMPLE
You might have a base class or interface called "Meal" that defines common properties and methods for different types of meals, such as breakfast, lunch, and dinner.
Each specific meal type would be a derived class that inherits from the "Meal" base class or implements the "Meal" interface.
## Abstraction is a concept that focuses on hiding unnecessary details and complexity while providing a simplified view of an object or system.
## For example, you might have an abstract "Repository" class that defines methods for fetching data from the TMDB API, filtering meals, and providing meal plans.