TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
FACEandLMS YouTube
NA
4
538
Objects without an immediate common parent and polymorphism
Jun 18 2017 2:25 PM
Instructions here:
[img]http://i.imgur.com/Nr2o9nt.png[/img]
http://i.imgur.com/Nr2o9nt.png
[img]http://i.imgur.com/YwxGjhm.png[/img]
http://i.imgur.com/YwxGjhm.png
Hi, If I understand the question right, the CalculateComplexityScore() method should take either a Cat, Dog or Butterfly object and perform actions on their properties (e.g. on ActionType) depending on wither the object is of Cat, Dog or Butterfly.
But Cat, Dog and Butterfly do not have a common immediate parents. They can't be redefined to have one. I have given CatBase, DogBase and Butterfly base a common parent: AnimalBase, but this would allow CalculateComplexityScore to take objects of CatBase, DogBase or ButterflyBase. If you read the instructions, this should not happen.
My attempt to solve this was to define an ActionType property as a virtual property in AnimalBase and have Cat, Dog and Butterfly override it but this is still not quite right.
Any help before tomorrow?
Reply
Answers (
1
)
Call web request in window application from within a class
CRUD in MVC kendogrid using custom commands