Object Oriented Programming

Base Knowledge

Programming in C language and algorithms. It is important that students have passed the 1st year Introduction to Programming and Programming curricular units.

Teaching Methodologies

The classes are theoretical and practical. In theoretical classes, an expository methodology is used to present the theoretical foundations of the subject with application examples. In the practical classes, students apply the knowledge of theoretical classes, developing applications, under the supervision of teachers. Outside the classes, the students develop, in groups of two, a medium-sized project that is evaluated in an intermediate phase and in a final phase. The teachers monitor the development of the project, clearing up doubts and providing guidance on the options taken.

Learning Results

1. Acquire object-oriented programming skills.

2. Acquire object-oriented programming skills in C++.

3. Acquire the ability to develop console C++ applications.

4. Acquire the ability to develop applications based on encapsulated and polymorphic data structures.

5. Improve the ability to organize, research, plan, justify solutions and document software projects.

6. Improve the aptitude for autonomous information research.

Program

General introduction to object-oriented concepts and the C++ language

  • General Concepts of Object Oriented Programming
  • Encapsulation, Polymorphism, Inheritance
  • SOLID Principles

 

Some differences between C and C++

  • Standard data input and output Structuring projects in .h and .cpp
  • Comments in C++
  • Definition of local variables
  • Predefined types
  • Type cast
  • References
  • Constants
  • Functions
  • Overloaded Functions
  • Functions with default arguments
  • Ambiguity situations in overloading

 

Classes

  • Class definition syntax
  • Classes as Structure evolution
  • Member functions
  • The this pointer
  • Inline Functions
  • Visibility (accessibility)
  • Constructors
  • Initialization syntax () and {}
  • initializer_list
  • Non-dynamic arrays of objects
  • Destructors
  • Inline member functions
  • static members: data and functions
  • constant member functions
  • friend functions

 

Objects life cycle

  • Destructor
  • Introduction to copy construction
  • Assignment. Introduction to the assignment operator

 

Dynamic objects

  • The new and delete operators
  • Dynamic arrays of objects

 

Operator overloading

  • General Introduction to Operator Overloading
  • Operator Functions
  • Unary and binary operators
  • Choice of member operators vs. non-member operators
  • Conversions operators

 

Composition and aggregation

  • Meaning of composition versus aggregation
  • Composition without dynamic memory – syntax, initialization requirements. Constructors and Destructors calling order
  • Aggregation by reference and pointer

 

Composition through dynamic memory

  • Concept of managing own resources in classes
  • Data members that are pointers to dynamic memory
  • Destructor, Assignment Operator, Copy Constructor

 

Object composition

  • Composition of objects and constructors
  • Basic Types in initialization list
  • Composition of objects and destructors

 

Inheritance in C++

  •  Derived classes
  •  Composition vs. derivation
  •  Forms of derivation and accessibility
  •  Constructors and destructors
  •  Copy constructor and assignment operator on derived classes
  •  Inheritance and overloaded functions

 

Polymorphism

  • Upcasting
  • Virtual functions
  • Abstract classes and pure virtual functions
  • Overloaded virtual functions and redefinition in derived classes
  • Virtual destructors

 

C++ Exception Mechanism

 

Introduction to the STL library

  • Notion of container and iterator
  • Classes of containers. Container manipulation.
  • Class vector. Class map. Classes for string manipulation. String, istringstream, ostringstream
  • Classes for stream I/O support ifstream and ofstream

 

Introduction to smartpointers in C++

  • unique pointer
  • shared pointer
  • weak pointer

Introduction to templates and STL library

  • Class Templates
  • Template arguments
  • Function templates

Curricular Unit Teachers

Internship(s)

NAO

Bibliography

Main references

Brokken, F. B. (2021).  C++ Annotations Version 12.4.0, University of Groningen publishing, http://www.icce.rug.nl/documents/cplusplus/   –  online

Stroustrup, B. (2000). A linguagem de programação C++, Bookman – 1ª-1-359

 

Auxiliary references

Lippman, S.B., Lajoie, J., Moo B. E. (2013).  C++ Primer (5th ed.), Addison-Wesley

Eckel, B. (2000). Thinking in C++  Vol.1 (2nd ed.), Prentice Hall Inc., http://www.bruceeckel.com/  –  1A-1-380 / Online

Deitel, P. J., Deitel, H. M. (2010). C++ How to Program (7th edition), Prentice Hall Inc. – 1A-1-425