Hi,
I could understand the difference between class and object. However, I
could find out a good definiton of type. how to understand the
relaitonship between type, class, and object? Thanks!
Michael 7 1960
Michael wrote:
I could understand the difference between class and object. However, I
could find out a good definiton of type. how to understand the
relaitonship between type, class, and object? Thanks!
'class' is a user-defined type (UDT, a very common TLA in OOP). A type
is a "kind" of objects, definiting common traits of all *instances* of
that type ("objects"). Types in C++ are characterized by the name and
the *definition*. Types in C++ consist of built-in and user-defined.
The definition of a UDT contains *declarations*, which describe the
representation and the behaviour of the instances of the UDT. The
representation and the behaviour of built-in types is defined in the
Standard.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Victor Bazarov wrote:
'class' is a user-defined type (UDT, a very common TLA in OOP). A type
is a "kind" of objects, definiting common traits of all *instances* of
that type ("objects"). Types in C++ are characterized by the name and
the *definition*. Types in C++ consist of built-in and user-defined.
The definition of a UDT contains *declarations*, which describe the
representation and the behaviour of the instances of the UDT. The
representation and the behaviour of built-in types is defined in the
Standard.
Could you please take an example for me to better understand it?
Victor Bazarov wrote:
Michael wrote:
I could understand the difference between class and object. However, I
could find out a good definiton of type. how to understand the
relaitonship between type, class, and object? Thanks!
'class' is a user-defined type (UDT, a very common TLA in OOP). A type
is a "kind" of objects, definiting common traits of all *instances* of
that type ("objects"). Types in C++ are characterized by the name and
the *definition*. Types in C++ consist of built-in and user-defined.
The definition of a UDT contains *declarations*, which describe the
representation and the behaviour of the instances of the UDT. The
representation and the behaviour of built-in types is defined in the
Standard.
I would think of type as "Class". Is thar right? There is no difference
to call "Class" or "Type".
Michael wrote:
Hi,
I could understand the difference between class and object. However, I
could find out a good definiton of type. how to understand the
relaitonship between type, class, and object? Thanks!
Michael
Well, in C++ : the types *include* the classes and objects are instances
of classes. Some types that are not classes :
C-like types : int, char, float
Function pointers types : int (*)(int,int)
Method pointers types : int (MyClass::*)(in t,int)
Other pointers type : int*, MyClass*
Pierre
Michael wrote:
Victor Bazarov wrote:
>Michael wrote:
>>I could understand the difference between class and object. However, I could find out a good definiton of type. how to understand the relaitonship between type, class, and object? Thanks!
'class' is a user-defined type (UDT, a very common TLA in OOP). A type is a "kind" of objects, definiting common traits of all *instances* of that type ("objects"). Types in C++ are characterize d by the name and the *definition*. Types in C++ consist of built-in and user-defined. The definition of a UDT contains *declarations*, which describe the representation and the behaviour of the instances of the UDT. The representation and the behaviour of built-in types is defined in the Standard.
I would think of type as "Class". Is thar right?
No, in C++ it's vice-versa. Did you actually read what I posted?
Types consist of built-in and user-defined. "class" is a user-defined
type. So class is a type. A 'type' is a wider concept than a 'class',
at least in C++.
There is no
difference to call "Class" or "Type".
In some circumstances there is. You can derive from a class, you
cannot, generally speaking, derive from a type.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
"Michael" <mi*******@gmai l.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
>
Victor Bazarov wrote:
>Michael wrote:
I could understand the difference between class and object. However, I
could find out a good definiton of type. how to understand the
relaitonship between type, class, and object? Thanks!
'class' is a user-defined type (UDT, a very common TLA in OOP). A type is a "kind" of objects, definiting common traits of all *instances* of that type ("objects"). Types in C++ are characterized by the name and the *definition*. Types in C++ consist of built-in and user-defined. The definition of a UDT contains *declarations*, which describe the representati on and the behaviour of the instances of the UDT. The representati on and the behaviour of built-in types is defined in the Standard.
I would think of type as "Class". Is thar right? There is no difference
to call "Class" or "Type".
Where do you get the word "Class" from? Are you referring to the keyword
"class", which denotes one kind of user-defined-type? (The other being the
keyword "struct".)
The concept of "type" in C++ means, basically, "what kind of thing is
this?". So, some examples of types are: int, char, and unsigned long.
These are built-in types, already defined in the language for you.
If you have a class definition like this:
class MyClass { /* member stuff here */ };
....then you have a user-defined type (or UDT), whose type is MyClass.
Likewise, the definition
struct MyStruct { /* member stuff here */ };
....defines a UDT, whose type is MyStruct.
(Sometimes in OOP, the terms "UDT" and "class" are used interchangeably , but
to me that can be confusing, since in C++ we also have UDTs which are
struct's, as I've shown.)
Given the above definitions,
MyClass aMyClassInstanc e;
....declares a variable called aMyClassInstanc e, whose type is MyClass, and
MyStruct aMyStructInstan ce;
....declares a variable called aMyStructInstan ce, whose type is MyStruct, and
-Howard
Howard wrote:
>
"Michael" <mi*******@gmai l.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
I would think of type as "Class". Is thar right? There is no
difference to call "Class" or "Type".
Where do you get the word "Class" from? Are you referring to the
keyword "class", which denotes one kind of user-defined-type? (The
other being the keyword "struct".)
Poor ol' "union", forsaken again.
Brian This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve Brown |
last post by:
Hello all,
Is there a way to determine a variable's type at run-time? The reason
I'm asking is that i have code that looks like this:
template <class T>
Object::Object(int TypeCode, T* data)
{
switch (TypeCode)
case 1:
|
by: E. Robert Tisdale |
last post by:
What is an object?
Where did this term come from?
Does it have any relation
to the objects in "object oriented programming"?
|
by: Matt |
last post by:
I want to know if "int" is a primitive type, or an object?
For example, the following two approaches yield the same result.
> int t1 = int.Parse(TextBox2.Text); //method 1
> int t2 = System.Int32.Parse(TextBox2.Text); //method 2
And people said "int" is a C# alias for "System.Int32". If this is the case,
can we say "int" is an object??
|
by: Mike in Paradise |
last post by:
I have an application that is being passed objects which could either be an instance or a Type in the case of a Static Class
When you do the GetType on the object that was originally a Static class it gives you a type of "System.RuntimeType" as opposed to the orignal Static Class Typ
How do you get access to what type the the Orginal Static Class type was from the RuntimeType??
//Eg Routine......
Object objects = new Object
Class1...
|
by: Nashat Wanly |
last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaskdr/html/askgui06032003.asp
Don't Lock Type Objects!
Why Lock(typeof(ClassName)) or SyncLock GetType(ClassName) Is Bad
Rico Mariani, performance architect for the Microsoft® .NET runtime
and longtime Microsoft developer, mentioned to Dr. GUI in an e-mail
conversation recently that a fairly common practice (and one that's,
unfortunately, described in some of our...
| |
by: René Nordby |
last post by:
Hi there,
Is there anyone that knows how to do the following?
I have a class A and a class B, that 100% inherits from class A (this means
that I don't have other code in class B, than the Inherit statement).
|
by: Dennis |
last post by:
I have a class named "myclass" and an arraylist containing elements of type
"MyClass". I want to get the value of a property of "MyClass" (a string
type) for one of the arraylist elements.
I can get this using:
dim b as string
b = DirectCast(myarraylist(0),myclass).myproperty
However, I want to use an object to define the type "MyClass" like:
dim C as type = type.GetType(myarraylist(0))
|
by: JohnR |
last post by:
I'm trying to find a way to create a variable of a given type at runtime
where I won't know the type until it actually executes. For example,
dim x as object = "hi"
x is declared as an object but x.gettype returns 'string', so it knows it
contains a string.
If I want to create a variable "y" as the same type that variable x contains
how would I do that without having to iterate thru every possible
|
by: JH |
last post by:
Hi
I found that a type/class are both a subclass and a instance of base
type "object".
It conflicts to my understanding that:
1.) a type/class object is created from class statement
2.) a instance is created by "calling" a class object.
|
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 actually the same thing:
- both are instances of a metaclass, and the same metaclass ('type')
can instantiate both classes and types.
- both can be instantiated and yield an "ordinary" object
- I can even inherit from a type and get a class
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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 we have to send another system
| | |