Results 1 to 4 of 4

Thread: What are the differences and similarity between a class and a structure in VB.NET.

  1. #1
    Join Date
    Apr 2009
    Posts
    55

    What are the differences and similarity between a class and a structure in VB.NET.

    Please let me know the differences and similarity between a class and a structure in VB.NET. This is because classes and structure has almost the same meaning but I think there would be some major points on the basis of which it would be differentiated.

  2. #2
    Join Date
    Jan 2009
    Posts
    99

    Re: What are the differences and similarity between a class and a structure in VB.NET.

    A struct cannot inherit from another struct or class, and it cannot be the base of a class. They are user-defined and provide a method for packing together data of different types. There is no inheritance for structs as there is for classes. Structures can be defined as a tool for handling a group of logically related data items. Structs, however, inherit from the base class Object. Both can have constructors, methods, properties , fields, constants , enumerations, events and event handlers. A struct can implement interfaces, and it does that exactly as classes do. Structure and class can implement interface.

  3. #3
    Join Date
    Feb 2008
    Posts
    137

    Re: What are the differences and similarity between a class and a structure in VB.NET.

    Structures are implicitly derived from a class called System.ValueType. The purpose of System.ValueType is to override the virtual methods defined by System.Object. When we create a struct object using the new operator, it gets created and the appropriate constructor is called. Both of them can have constructor without parameter and with parameter. Now VB.NET is object-oriented language. The following are some of the differences: Data Type Changes

  4. #4
    Join Date
    Feb 2008
    Posts
    180

    Re: What are the differences and similarity between a class and a structure in VB.NET.

    A Class has many uses in the object oriented environment of programming. One of its major advantages is that it can act as a blueprint for a new program you are about to write. When the runtime encounters a type derived from System.ValueType, then stack allocation is achieved. A Structure on the other hand deals with the data-type issue. if you are writing a job application program, you will need different types of data. It is an error to declare a default (parameterless) constructor for a struct. A default constructor is always provided to initialize the struct members to their default values.

Similar Threads

  1. What is the similarity between views and DBMS
    By Gonercase in forum Software Development
    Replies: 3
    Last Post: 10-01-2011, 03:55 AM
  2. What is the general structure of class in C++?
    By sRIPRIYA in forum Software Development
    Replies: 3
    Last Post: 04-01-2011, 08:31 AM
  3. How to compare images to check the similarity?
    By Zoey Mod in forum Software Development
    Replies: 5
    Last Post: 25-01-2010, 11:18 AM
  4. Similarity between Xbox and PC
    By Xanti in forum Portable Devices
    Replies: 3
    Last Post: 23-06-2009, 02:58 PM
  5. To test similarity of two images in Windows
    By Anas in forum Windows Software
    Replies: 3
    Last Post: 31-03-2009, 04:42 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,540,507.28847 seconds with 17 queries