Subtype and enclosing type

What is Subtype and enclosing type? What are their example?
LVL 9
william007Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

icrCommented:
http://en.wikipedia.org/wiki/Subtype
A general type "Bird" can be subclassed into multiple subtypes (inheritance). They share all the information with Bird, but can define their own as well. Here is another example, with some code:
public class Person
{
    public string Name;
}

public class Employee: Person
{
    public int Salary;
}

Because Employee is a subclass (because C# uses classes they tend to be called subclasses instead of subtype) of Person it inherits the Name field, but also adds it's own Salary field.

http://msdn2.microsoft.com/en-us/library/tdz1bea9(VS.71).aspx
To define an enclosing type we must first look at nested types. A nested type is when a type is defined inside another type:
public class TextBox
{
    public class Scrollbars
    {
    }
}
Which you can then reference by using TextBox.Scrollbars. However, unlike namespaces TextBox can also have it's own information and you can create instances of both TextBox and TextBox.Scrollbars.
In this instance TextBox would be Scrollbars enclosing type.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
william007Author Commented:
Thanks:)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.