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?
Re: variable and object?
"mkyong" <email@example.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?
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,
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....
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL