Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Main topics in this course are object-orientation, objects and classes, overloading, inheritance, polymorphism, generic programming, exception handling, introduction to design patterns. This lecture includes: Resource, Managment, Function, Return, Destructor, Class, File, Normal, Programmer, Error, Explicit, Catch, Exception, Throw, Derived
Typology: Slides
1 / 18
int function1(){
int function1(){
FILE *fileptr =
FILE *fileptr =
fopen( fopen(““filename.txtfilename.txt””,,““ww””););
throw exception();
throw exception();
fclose(fileptr); fclose(fileptr);
return 0; return 0;
class FilePtr{
class FilePtr{
FILE * f;
FILE * f;
public: public:
FilePtr(const char *name, FilePtr(const char *name,
const char * mode) const char * mode)
{ f = fopen(name, mode);}
{ f = fopen(name, mode);}
~FilePtr()
~FilePtr() { fclose(f);
{ fclose(f); }
operator FILE * ()
operator FILE * () { return f;
{ return f; }
►
►
►
►
Complex::~Complex()
Complex::~Complex()
try{ try{
throw Exception(); throw Exception();
catch(
catch( …
void Function1() { void Function1() {……}}
void Function2() throw () { void Function2() throw () {……}}
void Function3( )
void Function3( )
throw (Exception1,
throw (Exception1, …
… ){}
){}
► ► Function1 can throw any exceptionFunction1 can throw any exception
► ► Function2 cannot throw any ExceptionFunction2 cannot throw any Exception
► ► Function3 can throw any exception of type Exception1 orFunction3 can throw any exception of type Exception1 or
any class derived from it
any class derived from it
►
►
►
►
Information HidingInformation Hiding
EncapsulationEncapsulation
Abstraction
Abstraction
►
►
► ►
Simple associationSimple association
CompositionComposition
Aggregation
Aggregation
►
►
►
►
► ►
►
►
► ►
►
►
►
►
►►
►
►
►
►
Partial SpecializationPartial Specialization
Complete specializationComplete specialization