We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 13: Abstract Classes
Day 13: Abstract Classes
Sort by
recency
|
593 Discussions
|
Please Login in order to post a comment
Python 3
from abc import ABCMeta, abstractmethod class Book(object, metaclass=ABCMeta): def init(self,title,author): self.title=title self.author=author
@abstractmethod def display(): pass
Write MyBook class
class MyBook: def init(self, title, author, price): self.title = title self.author = author self.price = price def display(self):
title=input() author=input() price=int(input()) new_novel=MyBook(title,author,price) new_novel.display()
----------------MY full code ----- import java.io.; import java.util.;
abstract class Book { String title; String author;
}
class MyBook extends Book { int price;
}
public class Solution {
}
abstract class Book { String title; String author;
}
class MyBook extends Book { int price;
}
Just MyBook class Python implementation code: