VU Projects Video Lectures Handouts Past Papers Quizzes Assignments & GDB border= Members Free SMS Service FB Page
VU Projects Video Lectures Handouts Past Papers Quizzes Assignment,GDB Members SMS Service FB Page

Dear students,

The activity of Graded Discussion Board (GDB) will be conducted on February 07, 2017. Students will be able to post their comments for 48 hours only.

 

GDB Topic:

The main purpose of inheritance is reuse of code. Multiple-inheritance is more productive in terms of reuse of code than single inheritance. But all of this comes with a cost. Suppose we have a class Person which is inherited by Teacher and Student. Both Teacher and Student are further inherited by Teacher Assistant thus resulting in multiple-inheritance.

Click here for class diagram

Would you select multiple-inheritance in your code along with its intrinsic cost or do the other ways? Justify with solid reasons in either case.

Try to provide precise and to the point comments avoiding irrelevant details.

For any query, feel free to email at cs304@vu.edu.pk

Views: 738

Replies to This Discussion

plese share here your ideas

 

Solution of this Problem

Virtual Inheritance:

The solution to avoid this problem is virtual inheritance so that in multiple inheritance only one copy of base class is generated as shown below instead of two separate copies.In virtual inheritance there is exactly one copy of the anonymous base class object.


http://api.ning.com/files/KIUhBV3mdZ-WyV0QQ9xUejnhiqpVsVM1YDiDQqSBlZsXXbsM2JMFYYt4lhxsS3cRFm1OyDLwFL4C-BnTuCls7hGWgcRsB61i/

idea sol

Attachments:

RSS

SPONSORED LINKS

© 2017   Created by Muhammad Anwar Tahseen.   Powered by

Badges  |  Report an Issue  |  Terms of Service