Values, Variables, Types, Classes and Objects PowerPoint PPT Presentation

presentation player overlay
1 / 7
About This Presentation
Transcript and Presenter's Notes

Title: Values, Variables, Types, Classes and Objects


1
Values, Variables,Types, Classesand Objects
(c) Allan C. Milne School of Computing Creative
Technologies University of Abertay dundee
Last updated 2nd October 2005
2
Agenda
  • Values
  • Variables
  • Types
  • Classes Objects

3
Introduction
  • There is often confusion between values,
    variables and types.
  • Similarly for classes, objects and attributes (or
    fields).
  • We will try to explain the concepts and clarify
    the terminology.
  • This presentation is purely an outline, examples
    and explanations will be given in the lecture.

4
Values
  • Values are the bit sequences in memory that
    represent some quantity.
  • Values might be
  • primitive quantities (eg integers, reals ).
  • structured quantities (eg objects, structs).
  • Expressions return values.
  • It is values that are passed as parameters and
    returned by methods.

5
Variables
  • Variables are the names of memory locations that
    contain values.
  • Fundamentally, the variable name identifies the
    location of the value.
  • However, the variable name is often used with an
    implicit dereference to access the value stored
    in the location.
  • Variables might be local, fields, parameters.

6
Types
  • Types define the kind of values that are
  • contained in a variable,
  • passed as a parameter,
  • returned by a method.
  • User-defined types can be created.
  • Types describe kinds of values, they do not have
    values themselves.
  • Types form the basis of checking that actions are
    compatible or valid.

7
Classes and Objects
  • A class is a type
  • it defines the kind of things that must be in
    values of the class.
  • Classes define members that can be fields,
    methods, properties or events
  • each member has its own type.
  • An object (or instance) of a class is a value of
    the class type
  • each member is a value of its defined type.
Write a Comment
User Comments (0)
About PowerShow.com