DART: implementation of abstract method in extended class

96 views
Skip to first unread message

Ricardo Julião

unread,
Jul 9, 2022, 2:20:54 PM7/9/22
to Dart Misc
Hi i have post this question on stackoverflow:

abstract class A{
 _myAbstractMethod();
}

 class B extends A{
 }


in class B there is the necessity of implement the abstract method  _myAbstractMethod but this is only true if the both class are in the same file.
If this two class is on separated files than class B cannot access the private method.

how to turn around this?

I want extend a class with a abstract method and then implement this method!
can you help me?

Chris Norman

unread,
Jul 9, 2022, 3:22:48 PM7/9/22
to mi...@dartlang.org
I think the best way is just not to make the method private.

You can use the internal annotation to warn people not to use the pretend-private method outside of your package.

HTH,

Take care,

Chris Norman



--
For more ways to connect visit https://dart.dev/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/e04c031d-6ff8-4a03-8125-304af53ba8c2n%40dartlang.org.
Reply all
Reply to author
Forward
0 new messages