100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS2614 Summary (Programming: Contemporary Concepts) COMPLETE! R55,00
Add to cart

Summary

COS2614 Summary (Programming: Contemporary Concepts) COMPLETE!

 67 views  13 purchases

COS2614 Summary (Programming: Contemporary Concepts) COMPLETE! his summary contains in depth concepts, explanations and examples which will not only allow you to reduce the amount of time you have to study, but will also assist you with getting a distinction for this module. This summary will rep...

[Show more]

Preview 4 out of 92  pages

  • Yes
  • August 27, 2021
  • 92
  • 2021/2022
  • Summary
  • cos2614 summary
book image

Book Title:

Author(s):

  • Edition:
  • ISBN:
  • Edition:
All documents for this subject (47)
avatar-seller
Passingtips
COS2614 Summary
(Programming: Contemporary
Concepts)
COMPLETE

,c++ general summary:
Creating class in QT:
Right click on your project, say add new, then chose class. Then just type in
class name and header and cpp file will automatically be created for you.
Also, right click on a function and go refactor, then go add definition in .cpp file
then it will create an auto implementation for you.



General theory:
Partial overriding:
To implement an overridden function using partial overriding that means we
call the overridden function in the overwriting function to calculate something.
E.g. say calculateRental() was overridden

double Video::calculateRental(int num) const{

double rental = Film::calculateRental(num); //calling the overridden function

return (rental - (rental * discount / 100)) ;
}

Features of QMainWindow that allows for QAction objects:
QMenu and QToolBar

setCentralWidget(QWidget *wt)
Note this function takes a QWidget object, but you can add view classes object
inside as argument since the view class derived from QDialog or
QMainWindow and those classes derive from QWidget.
You can also put widgets like button as central widget since buttons derive
from Viewclass which derive from QDialog which derives from QWidget.

3 visible features that can be added to QAction(sub menus)
Text, icon, shortcut, tooltip

Destructor when QMap and QList are data members

,Both fooLsit and fooMap point to Foo objects. The 1st statement deallocate the memory occupied by
the objects. Now the 2nd statement tries to deallocate the Foo objects, but since they have already
been deallocated a runtime error will occur. Sollution is to remove one of the statements.

Implicit sharing application of Qt containers(lists)
When a copy of a Qt container is made, the data values stored in the container are not
copied unless a change is made to one or more elements of either container. Implicit
sharing saves memory, and delays the process of copying containers until it is necessary

Abstract class
An abstract class is a class that is designed to be specifically used as a base class.
An abstract class contains at least one pure virtual function which will get overridden by an
inheriting class.

Coutn function to check if there are repeated numbers in a
list:
foreach(int i, result){
if(result.count(i) > 1){ //here we use count function, count returns
number on instances of argument in the list, result is the list
message = "Input contains repetitions.";
}


When a function is written skew in UML then it is pure
virtual function, when it is not, but appear in inheriting
classes then it is non pure virtual function.
Purpose of having a function in a list class that adds objects
of the list instead of using the append.

, To implement a customized element addition to QList, which is different from the addition offered by the
append() of QList . For example, to ensure that all objects pointed to by Account*s in AccountList have unique
account numbers


Note when we working with a List Class which have no
members and we want to call it’s functions then just go this-
> before the function call or call it by itself:
double SavingsAccount::totalBalance() const{

double result = 0;


for(int i =0; i < this->size(); i++){ //call size() without object, e.g. object.size

result += this->at(i)->getBalance(); //call list’s at() function without object @ front

} return result;

}


Constructor of this list class without data members
AccountList::~AccountList() {

qDeleteAll(*this); //give pointer to the current class

}



Creating QAction object with icon saved in file Done.png
and the title “Done”:
QAction *action = new QAction(QIcon("Done.png"), "Done", this);


UML Notation and what it means:
Composition/aggregation relationship: It is when a class is a
member in another class we say that the member class is a
part of the other class. It is shown by a diamond. The side of
the diamond is a class who contain the other class as a
member.

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Passingtips. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R55,00. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

50843 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R55,00  13x  sold
  • (0)
Add to cart
Added