Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft ASP .NET
New to Classes, please help.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Kevin Spencer, post: 3861932"] As David is "new to classes," I thought I'd follow up your excellent advice with a bit of more detailed information about classes. A class is a data type, just as an integer or a string. A data type specifies both the type of data stored in an instance of that type, as well as the amount of memory necessary to allocate to store that type of data. An Integer, for example, is a 32-bit storage space that contains an integer value (remember that underneath it all it's just 1s and 0s). A string is a pointer to an array of characters. Note that an array is also a data type, as well as a pointer. A pointer is the address in memory of the object being pointed to. It is the size of a memory address. Structures were clreated before classes. A structure is an aggregate data type (like an array), which can contain multiple data types in a single storage space. A simple structure, for example, could contain an integer and a string. The size of the structure would be 32-bits plus the size of the pointer to the string. A structure can also have process. That is, you can make a function a member of a structure. So, you can see by now that a structure is a primitve class of sorts. With the advnet of OOP, classes were created. Classes are basically structures, but have additional properties, such as Inheritance, Encapsulation, Polymorphism and Abstraction. For example, a class can have private or public members (plus several others). Private class members cannnot be accessed outside the class. Inheritance gives you the ability to EXTEND a class with an inherited class. By using Inheritance, all the characteristics of the base class are automatically attributed to the inherited class, which can extend the base class with additional properties or functionality. As to Shared classes and members: A program has 2 basic memory areas: The stack and the heap. The heap is where all the code for the program is loaded when the program starts. In a sense, it is an in-memory copy of the program, and all of its process and data. It is a single "instance" if you will, of all the code. As the program runs, functions are called. Ordinarily, a copy ("instance") of the function is placed on top of the stack, where it remains until the function returns. However, a static method or piece of data is not instantiated. A copy is not placed on the stack every time the method is called. Instead, the single "copy" in the heap is used. that single copy is used by all aspects of the program. As there is only one (hence "singleton"), it is not thread-safe. In a sense, it is "shared" by all functions that call it. -- HTH, Kevin Spencer Microsoft MVP ..Net Developer What You Seek Is What You Get. [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft ASP .NET
New to Classes, please help.
Top