Class Declaration - Research Article from World of Computer Science

This encyclopedia article consists of approximately 2 pages of information about Class Declaration.

Class Declaration - Research Article from World of Computer Science

This encyclopedia article consists of approximately 2 pages of information about Class Declaration.
This section contains 452 words
(approx. 2 pages at 300 words per page)
Buy the Class Declaration Encyclopedia Article

A class declaration is a blueprint for what a class will look like, the data members it will contain, and the functions it will have. In C++ a class declaration is typically made in a "header file" or "include file." A class declaration is essentially an interface specification that says what a class will look like and what it does rather than how it does it.

Java does not have pure declarations like C++ does, and, indeed, it is possible in C++ to combine declaration (interface) with definition (implementation) in the same portion of code.

Take these two examples. The first is a C++ class declaration. It tells the compiler that "this is what an eggTimer looks like and what it can do":

  • class eggTimer {
  • public:
  • int timeEgg (int t);
  • private:
  • void ringBell();
  • };

It does not say anything about exactly how the egg will be timed...

(read more)

This section contains 452 words
(approx. 2 pages at 300 words per page)
Buy the Class Declaration Encyclopedia Article
Copyrights
Gale
Class Declaration from Gale. ©2005-2006 Thomson Gale, a part of the Thomson Corporation. All rights reserved.