C++ Neural Networks and Fuzzy Logic:C++ and Object Orientation
Click Here!
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
C++ Neural Networks and Fuzzy Logic
(Publisher: IDG Books Worldwide, Inc.)
Author(s): Valluru B. Rao
ISBN: 1558515526
Publication Date: 06/01/95
Search this book:
Previous
Table of Contents
Next
Writing C++ Programs
Before one starts writing a C++ program for a particular problem, one has to have a clear picture of the various parameters and variables that would be part of the problem definition and/or its solution. In addition, it should be clear as to what manipulations need to be performed during the solution process. Then one carefully determines what classes are needed and what relationships they have to each other in a hierarchy of classes. Think about is-a and has-a relationships to see where classes need to defined, and which classes could be derived from others. It would be far more clear to the programmer at this point in the program plan what the data and function access specifications should be and so on. The typical compilation error messages a programmer to C++ may encounter are stating that a particular function or data is not a member of a particular class, or that it is not accessible to a class, or that a constructor was not available for a particular class. When function arguments at declaration and at the place the function is called do not match, either for number or for types or both, the compiler thinks of them as two different functions. The compiler does not find the definition and/or declaration of one of the two and has reason to complain. This type of error in one line of code may cause the compiler to alert you that several other errors are also present, perhaps some in terms of improper punctuation. In that case, remedying the fundamental error that was pointed out would straighten many of the other argued matters.
The following list contains a few additional particulars you need to keep in mind when writing C++ programs.
A member x of an object A is referred to with A.x just as done with structure elements in C.
If you declare a class B, then the constructor function is also named B. B has no return type. If this constructor takes, say, one argument of type integer, you define the constructor using the syntax: B::B(int){whatever the function does};
If you declare a member function C of class B, where return type of C is, say, float and C takes two arguments, one of type float, and the other int, then you define C with the syntax: float B::C(float,int){whatever the function does};
If you declare a member function D of class B, where D does not return any value and takes no arguments, you define D using the syntax: void B::D( ){whatever the function does};
If G is a class derived from, say, class B previously mentioned, you declare G using the syntax: class G:B. The constructor for G is defined using the syntax: G::G(arguments of G):B(int){whatever the function does}. If, on the other hand, G is derived from, say, class B as well as class T, then you declare G using the syntax: class G:B,T.
If one class is declared as derived from more than one other class, that is, if there are more than one base class for it, the derivations specification can be different or the same. Thus the class may be derived from one class publicly and at the same time from another class privately.
If you have declared a global variable y external to a class B, and if you also have a data member y in the class B, you can use the external y with the reference symbol ::. Thus ::y refers to the global variable, whereas y, within a member function of B, or B.y refers to the data member of B. This way polymorphic functions can also be distinguished from each other.
This is by no means a comprehensive list of features, but more a brief list of important constructs in C++. You will see examples of C++ usage in later chapters.
Summary
A few highlights of the C++ language are presented.
C++ is an object-oriented language with full compatibility with the C language.
You create classes in C++ that encapsulate data and functions that operate on the data, and hiding data where a public interface is not needed.
You can create hierarchies of classes with the facility of inheritance. Polymorphism is a feature that allows you to apply a function to a task according to the object the function is operating on.
Another feature in C++ is overloading of operators, which allows you to create new functionality for existing operators in a different context.
Overall, C++ is a powerful language fitting the object-oriented paradigm that enables software reuse and enhanced reliability.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-1999 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
027 030 (2)027 030027 030027 030 uvlqa64dzuplltk3q5zbmkac7eyatwt6mjdma5qF F 030E B 027v 02 027026 027Pokemon odcinek 030027 Ustawa o izbach lekarskich030 Ustawa o wyborze Prezydenta Rzeczypospolitej Polskiejwięcej podobnych podstron