473,386 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

What is the difference between type and class

ad
I am confuse about type and class in some book about C#.
What is the difference between type and class?
Nov 16 '05 #1
4 6484
They are basically the same i guessed.

Also, there is a class called Type in .NET. To get a type from a class
you would go Type t = typeof(ClassName);
On Mon, 24 Jan 2005 15:15:50 +0800, "ad" <ad@wfes.tcc.edu.tw> wrote:
I am confuse about type and class in some book about C#.
What is the difference between type and class?


Nov 16 '05 #2
"Type" is used when we are discussing types. In simple words, you see that
whenever we use variables, they "always" have a type no matter if they are
int, float, string, stringbuilder, FileStream. They are all types, but not
all of them are classes! int is not a class, it is a struct or "value type"
in .net terminology.

Ab.
http://joehacker.blogspot.com
"qwerty" <no@email.net> wrote in message
news:a6********************************@4ax.com...
They are basically the same i guessed.

Also, there is a class called Type in .NET. To get a type from a class
you would go Type t = typeof(ClassName);
On Mon, 24 Jan 2005 15:15:50 +0800, "ad" <ad@wfes.tcc.edu.tw> wrote:
I am confuse about type and class in some book about C#.
What is the difference between type and class?

Nov 16 '05 #3
The way I see it, a type is anything that can be used to "type" a variable.
And that doesn't always need to be a class. Enumerations, for example, are
not classes but they are types because a variable can be typed as an
enumeration.

In general, the .NET Framework recognizes these types:

- Value types, for example int, bool, and any enumerations and structs you
create in your code.
- Reference types, i.e., classes, interfaces, arrays, and delegates.

Hope this makes sence.

--
Michal Boleslav Mechura
va******@hotmail.com

"Abubakar" <em**********@yahoo.com> wrote in message
news:um**************@tk2msftngp13.phx.gbl...
"Type" is used when we are discussing types. In simple words, you see that
whenever we use variables, they "always" have a type no matter if they are
int, float, string, stringbuilder, FileStream. They are all types, but not
all of them are classes! int is not a class, it is a struct or "value
type"
in .net terminology.

Ab.
http://joehacker.blogspot.com
"qwerty" <no@email.net> wrote in message
news:a6********************************@4ax.com...
They are basically the same i guessed.

Also, there is a class called Type in .NET. To get a type from a class
you would go Type t = typeof(ClassName);
On Mon, 24 Jan 2005 15:15:50 +0800, "ad" <ad@wfes.tcc.edu.tw> wrote:
>I am confuse about type and class in some book about C#.
>What is the difference between type and class?
>


Nov 16 '05 #4
ad... it depends on the definition of type. if you define type as a
public interface then a class can have many types. a reference variable
has type and an object has class.

Regards,
Jeff
What is the difference between type and class?<


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
11
by: Shea Martin | last post by:
I have been programming in C++ for over 4 years. I *think* I knew that a struct could have a constructor but I decided to dig into it a little more today, and found that there is very little...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
17
by: SemSem | last post by:
i want to know waht is an index and how we use it with a simple example including the main of the program . thanx -- Islam Khalil,
6
by: JonathanOrlev | last post by:
Hello everyone, I have a newbe question: In Access (2003) VBA, what is the difference between a Module and a Class Module in the VBA development environment? If I remember correctly, new...
23
by: Jess | last post by:
Hello, I understand the default-initialization happens if we don't initialize an object explicitly. I think for an object of a class type, the value is determined by the constructor, and for...
21
by: Nikolaus Rath | last post by:
Hello, Can someone explain to me the difference between a type and a class? After reading http://www.cafepy.com/article/python_types_and_objects/ it seems to me that classes and types are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.