variable and object?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: variable and object?

  1. #1
    mkyong Guest

    variable and object?


    what is object of an abstract class and variable of an abstract class?
    Can someone tell me what is the different between object and variable?
    Example,please 8)


  2. #2
    Jeff Johnson Guest

    Re: variable and object?


    "mkyong" <mkyong2002@yahoo.com> wrote:
    >
    >what is object of an abstract class and variable of an abstract class?
    >Can someone tell me what is the different between object and variable?
    >Example,please 8)


    A variable is just a single piece of data (a string, an integer...)

    An object can contain several variables. Some will be exposed to other programmers,
    others would be for the object's internal use. (The Employee object would,
    for example, contain a Name string, a salary integer, etc.)

    Objects also have methods (which are really just functions or subroutines.)
    The Employee object would have all the routines for messing with Employees:
    The giveRaise method, the fire method, and the overWorkTilHeGoesNuts method,
    for example.

    You may have serveral types of employees in a large company. Some would
    get a severance package when they're fired; others just get the boot. This
    is where abstract classes come in. You make the Employee object an Abstract
    class; it has all the data and methods, but it doesn't necessarily do anything.
    You then make other classes that "extend" the Employee object by telling
    it what to do. So the Bigwig and Peon object would look like an Employee
    objects-- just behave differently!!

    Hope this helps....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center