Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Can we skip parents methods in certain classes

(0) ShareShare
ReportReport
Posted on by 1,550
Hi,
 
 
So let's say we have base class A
Class B is child of A
Class C is child of B
 
And let's say the base class A has a method with some
logic called commonMethod
 
In class B that extends A, I don't want to apply the logic in the common method so i overrided it and returned nth
 
Now in class C that extends B...i want the logic of the method in the base class
 
Can i let class C skip B in this certain method and look at the base method?
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    Can we skip parents methods in certain classes
    No, it's not possible. You'll need to look a better design.
     
    For example, class A may have a method that decides whether the logic should be run or not. It would return true in class A, class B would override it and return false and class C would override it again and return true.
     
    Or maybe C shouldn't extend B at all, if the logic of its current parent (B) isn't suitable.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans