Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 27th, 2005, 04:15 AM
Registered User
 
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default object class and multiple inheritance

System.Object Class is inherited to every class we create in .net ,at the same time it is being said that-mutiple inheritance is not supported.ie only single inheritance is possible.Then how is the object class inherited?


 
Old July 27th, 2005, 05:37 AM
Authorized User
 
Join Date: Nov 2004
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to avanishp
Default

Multiple inheritance not possible means a class can not derive from more than one class . This is not possible in .NET, but you can implement multiple interfaces in .NET






Avanish Pandey
Set your heart upon your work, but never on its reward
 
Old August 8th, 2005, 12:12 PM
Registered User
 
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

[quote]Originally posted by avanishp
 Multiple inheritance not possible means a class can not derive from more than one class . This is not possible in .NET, but you can implement multiple interfaces in .NET






object is a class and not an interface.so the question is how can we inherit another class into a newly created class which is by default inheriting the object class OR how the inheritance of object class is impelmented?

 
Old August 8th, 2005, 12:42 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

All objects in .NET derive (explicitly or implicitly) from the System.Object class. Classes can derive from other classes that are derived from other classes... and so on. Take the System.Web.UI.WebControls.DataGrid for example:

System.Object
   System.Web.UI.Control
      System.Web.UI.WebControls.WebControl
         System.Web.UI.WebControls.BaseDataList
            System.Web.UI.WebControls.DataGrid

The DataGrid class is one class that only inherits 1 class. But the inheritance chain goes back 4 classes until it reaches System.Object. This does not mean that the class is derived from more than one class.

On the other hand, take the System.Collections.Specialized.StringCollection class:

System.Object
   System.Collections.Specialized.StringCollection

Public Class StringCollection
   Implements IList, ICollection, IEnumerable

This class derives from System.Object alone, but implements 4 interfaces.

-Peter
 
Old August 11th, 2005, 05:17 AM
Registered User
 
Join Date: Jul 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Consider that there are two classes named ClassA and ClassB
Then by default these two classes are inherited from the System.Object class.Suppose we are inheriting ClassA to ClassB .
Then we are are inheriting 2 classes(System.Object implicitly and ClassA explicitly) to ClassB .so how is this possible as multiple inheritance is not supported in C#?ie how is this implemented?



 
Old August 13th, 2005, 10:12 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

wht u r talking abt is Multi Level Inheritance

its not Multiple Inheritance










Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Class and Multiple inheritance deepthraj BOOK: Professional C#, 2nd and 3rd Editions 1 May 23rd, 2006 12:57 PM
Question about Class Inheritance forkhead Pro VB.NET 2002/2003 0 March 21st, 2005 03:37 PM
Newbie question on the 2nd ed: Class inheritance elde BOOK: Professional C#, 2nd and 3rd Editions 0 December 9th, 2004 03:00 AM
base class inheritance krunch97 VB.NET 2002/2003 Basics 6 April 23rd, 2004 11:48 AM
how to pass multiple values throw url class object kfarooq Servlets 1 June 20th, 2003 04:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.