Solved

Object can only inherit from one parent?

Posted on 2012-03-14
3
333 Views
Last Modified: 2012-03-15
I had a an online test for a job and they asked this question and I'm not sure whether I blew it. It sounds like it may be a trick question.

I answered yes.

I think the question may have actually been "objects can only inherit from a parent" in which case, what would that answer be?
0
Comment
Question by:Eindoofus
  • 2
3 Comments
 
LVL 3

Expert Comment

by:DaFranker
ID: 37723259
Perhaps this article might provide some clarification: .NET and Multiple Inheritance - David C. Chou
0
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 500 total points
ID: 37723268
Hmm... Not too correct question, I'd say. Not objects. Classes. Classes may inherit from one parent only.

"objects can only inherit from a parent"  - there is one parent in inheritance but there are grand parent, grand-grand... etc.
0
 
LVL 29

Assisted Solution

by:anarki_jimbel
anarki_jimbel earned 500 total points
ID: 37723273
http://msdn.microsoft.com/en-us/library/ms973803.aspx

"In the .NET world, only single inheritance is allowed, so each subclass will have only one base class.

There are three types of inheritance that .NET supports: implementation, interface, and visual. Implementation inheritance refers to the ability to use a base class's properties and methods with no additional coding. Interface inheritance refers to the ability to use just the names of the properties and methods, but the child class must provide the implementation. Visual inheritance refers to the ability for a child form (class) to use the base forms (class) visual representation as well as the implemented code.

A class in .NET may inherit from a class that has already inherited from another class. In addition you may use an interface or even multiple interfaces within a class."

If question was like ""objects can only inherit from a parent" " - the answer would be No as it may inherit from grandparents... Hate these questions and people asking them :)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
2 questions 10 25
performance issue in asp web 5 32
Switching Visual Studio 2015 to normal debug display 3 27
JSON  parse help 7 26
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question