Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main() {
- Child obj = Child();
- obj.childMethod();
- obj.parentMethod();
- obj.grandParentsMethods();
- }
- class GrandParents{
- void add(int a, int b){
- print (a+b);
- }
- // void add(int a, int b, int c){
- // print (a+b+c);
- // }
- void grandParentsMethods(){
- print ("This is Grand parents.");
- }
- }
- class Parents extends GrandParents{
- void parentMethod(){
- print("This is Parents.");
- }
- }
- class Child extends Parents{
- // void childMethod(int a, int b){
- // print (a-b);
- // }
- void childMethod(){
- print ("This is Child.");
- }
- Child(){
- print ("This is Constructor");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement