Thursday, December 4, 2014

cs Oct 14, 2014




   return code : may be invalid or valid depending on the function so that can always not be used for exception handling..

if (area() < 0) error (" "); // just throwing an error not handling it..

sometimes there is no return code that indicates error.

g++ -c causes it to not call the linker.

class Bad_area{
    Bad_area(){};  //default constructor, {} imply definition
}

class Plant
{
 public:
   Plant(); // default ctor.
 private:
    int stems;
    const double pi;
};

Plant::Plant()
:pi(3.14154),stems(i)  // member initialization list
{

}

Date d1;
Date d2(2014);
Date d3(2014,10);
Date d4(2014,10,14);

#define vector Vector

vector<int> v;

v[0]; would throw an exception because of the define statement above.

OOP is extending the language by building new types in the new domain..

2 types of C++ UDT's classes enumerations

classes are new types that composites of other types..
enum are new types that are subsets of int.

Lab 4

Unit test each member of two cards

Download all the files from blackboard
in tinycore get lab4.sh to run (set mode to 755)
src2latex and pdlatex 5 times
cleantex.sh remove comments from tex files. (chmod 755)
make scripts executable
create any missing files.

 -create twocards.cpp minimum is 1 comment

Interaction of objects
Credit_card c1;
Credit_card c2;
Twocards tc(c1,c2);

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home