I always use the word "class" to describe a class that can be instantiated.
However, I don't get the concept of "Type" or at least I don't know how to
use the word properly. If I have a class called Person, what is its "Type"
and how does it relate to the class?
Thanks in advance.
mark 12 1567
Mostly, "class" refers particularly to references types, while "type"
refers to both Reference Types, and Value Types
"Mark" <fi******@idonotlikejunkmail.umn.edu> wrote in message
news:#u**************@TK2MSFTNGP12.phx.gbl... I always use the word "class" to describe a class that can be
instantiated. However, I don't get the concept of "Type" or at least I don't know how to use the word properly. If I have a class called Person, what is its
"Type" and how does it relate to the class?
So this means I could just as well talk about my "Person type", and just
chuck my previous wording of "Person class?" I'm hoping there is a more
precise difference between the two ...
Thanks again.
Mark
"James Curran" <ja*********@mvps.org> wrote in message
news:uz**************@tk2msftngp13.phx.gbl... Mostly, "class" refers particularly to references types, while "type" refers to both Reference Types, and Value Types
"Mark" <fi******@idonotlikejunkmail.umn.edu> wrote in message news:#u**************@TK2MSFTNGP12.phx.gbl... I always use the word "class" to describe a class that can be instantiated. However, I don't get the concept of "Type" or at least I don't know how
to use the word properly. If I have a class called Person, what is its "Type" and how does it relate to the class?
A class is a template that defines the members and operations of a
type.
....if that helps! :)
P.
Just out of curiosity, I looked it up in that MSDN glossary:
class
A reference type that encapsulates data (constants and fields) and behavior
(methods, properties, indexers, events, operators, instance constructors,
static constructors, and destructors), and can contain nested types. Class
types support inheritance, a mechanism whereby a derived class can extend
and specialize a base class.
common type system
The specification that determines how the common language runtime defines,
uses, and manages types.
Using the System.Reflection namespace yields a greater appreciation of where
Class ends and Type begins..but to answer your question most use the
phrasing "Person Class" and "Type of Person" interchangeably.
ok,
aq
"Paul E Collins" <fi******************@CL4.org> wrote in message
news:ct**********@titan.btinternet.com... A class is a template that defines the members and operations of a type.
...if that helps! :)
P.
Paul E Collins <fi******************@CL4.org> wrote: A class is a template that defines the members and operations of a type.
...if that helps! :)
I'm not sure it does, because that describes a struct as well.
To my mind, it's as James described it - class is used for most
reference types (other than delegates, which are just called delegates)
whereas enums and structs are also types.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
There are of course different definitions of a type. If you define a
type as a defined public interface then a class can have zero or more
types. For instance, a class can inherit from Object and implement
IDisposable then the class defines at least two specific public
interfaces, Object and IDisposable.
Class MyClass : Object, IDisposable;
MyClass c= new MyClass(); // object of class MyClass,
// reference var c of type MyClass
Object o= new MyClass(); // object of class MyClass
// ref variable o of type object
IDisposable d= new MyClass(); // object of class MyClass
// ref var d of type IDisposable
Regards,
Jeff
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
You may get it this way...
You can have a class called Person, and if you create a new object of type
Person called lobjPerson... you can say that lobjPerson is a object of type
Person.
Regards,
Nirosh.
"Mark" <fi******@idonotlikejunkmail.umn.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... So this means I could just as well talk about my "Person type", and just chuck my previous wording of "Person class?" I'm hoping there is a more precise difference between the two ...
Thanks again.
Mark
"James Curran" <ja*********@mvps.org> wrote in message news:uz**************@tk2msftngp13.phx.gbl... Mostly, "class" refers particularly to references types, while
"type" refers to both Reference Types, and Value Types
"Mark" <fi******@idonotlikejunkmail.umn.edu> wrote in message news:#u**************@TK2MSFTNGP12.phx.gbl... I always use the word "class" to describe a class that can be instantiated. However, I don't get the concept of "Type" or at least I don't know
how to use the word properly. If I have a class called Person, what is its
"Type" and how does it relate to the class?
"Mark" <fi******@idonotlikejunkmail.umn.edu> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... I always use the word "class" to describe a class that can be instantiated. However, I don't get the concept of "Type" or at least I don't know how to use the word properly. If I have a class called Person, what is its "Type" and how does it relate to the class?
It's fairly simple. a class and a struct are both types.
As a chair and a table are both furniture.
Mark wrote: I always use the word "class" to describe a class that can be instantiated. However, I don't get the concept of "Type" or at least I don't know how to use the word properly. If I have a class called Person, what is its "Type" and how does it relate to the class?
Thanks in advance.
mark
In some sense, class is just a more complicated type.
Think of struct as something in between.
You can instantiate an Integer() type just as well as any other "class"
-- it's just the class type has both properties and methods.
The idea of a type is a formatted structure.
We speak of /primitive/ types, int, string and so on.
--
Texeme http://texeme.com
Ricola ! <se****************@tower.effeil> wrote: Mark wrote: I always use the word "class" to describe a class that can be instantiated. However, I don't get the concept of "Type" or at least I don't know how to use the word properly. If I have a class called Person, what is its "Type" and how does it relate to the class?
Thanks in advance. In some sense, class is just a more complicated type.
Think of struct as something in between.
In between what?
You can instantiate an Integer() type just as well as any other "class" -- it's just the class type has both properties and methods.
Structs can have properties and methods too.
The idea of a type is a formatted structure.
.... with associated behaviour.
We speak of /primitive/ types, int, string and so on.
Actually, string isn't a primitive type.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
This may help
Categories of types
Types can be classified with following categories:
primitive types - simplest kind of type e.g. integer and floating-point
number
composite types - types consisting of basic types e.g. abstract data
types
subtype and derived type
function types e.g. binary functions
object types e.g. type variable
class types i.e. type of an object
interfaces i.e. type of a dependency
protocols i.e. type of a communication channel
kinds i.e. type of a type
Regards,
Jeff
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kevin |
last post by:
Hi! I recently completed a graduate level Java class at a local
university. For our class project my group built a web-based
application. Basically, the application would let a manufacturing...
|
by: Tongu? Yumruk |
last post by:
I have a little proposal about type checking in python. I'll be glad
if you read and comment on it. Sorry for my bad english (I'm not a
native English speaker)
A Little Stricter Typing in Python...
|
by: BillyO |
last post by:
I need a general mechanism for passing parameters to an API function I
am designing, call it foo. Foo processes data, the operation used to
process the data and the parameters for that operation...
|
by: johny smith |
last post by:
I never really know if I should use references or pointers for constructors.
Can anyone give me some guidance on when to use what?
My back ground is C, so I tend to use pointer notation, but...
|
by: Andrew Robinson |
last post by:
I need to create a shared static field for use within a number of different
classes. Which one should I be using or are they all really the same thing?
public class Widget
{
private Widget() {}...
| |
by: John Granade |
last post by:
I'm sure this has been asked but after searching the Internet, I just can
find a clear answer. When should you add a component versus a class to you
Windows Forms application?
The timer is a...
|
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...
|
by: peter.tornqvist |
last post by:
Maybe I'm stupid or maybe I am missing the obvious, but I can't find a way
to define a type alias in C# for primitive types (class and interfaces I can
inherit from, no problem). I.e I want to...
|
by: blangela |
last post by:
I have decided (see earlier post) to paste my Word doc here so that it
will be simpler for people to provide feedback (by directly inserting
their comments in the post). I will post it in 3 parts...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |