Irum Feroz

Generation

translateFri, 07 Apr 2023

write a program in which use the inheritance and design the pizza menu

class Pizza { String pizza_name; int price; Pizza(this.pizza_name, this.price); void showInfo() { print('Pizza name: $pizza_name,\t price: $price'); } } class PizzaWithExtraCheese extends Pizza { int extraCheese_price; PizzaWithExtraCheese(String pizza_name, int price, this.extraCheese_price) : super(pizza_name, price); @override void showInfo() { print( 'Pizza name: $pizza_name,\t price: $price,\t extra cheese price: $extraCheese_price '); } } class PizzaWithExtraToppings extends Pizza { int toppings_price; PizzaWithExtraToppings( String pizza_name, int price, this.toppings_price) : super(pizza_name, price); @override void showInfo() { print(

Questions about programming?Chat with your personal AI assistant