ics45c: minitest 2

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/23

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

24 Terms

1
New cards

g++

2
New cards

.hpp

3
New cards

.cpp

4
New cards

.tpp

5
New cards

function overloading

  • reusing function names w/o overwriting

  • AS LONG AS FUNCTION SIGNIATURE CHANGES

    • func name

    • param types

    • param orders

  • PARAM NAMES DONT MATTER!

6
New cards

static cast

  • static_cast<new_type>(expression)

  • simple conversiom

7
New cards

dynamic cast

  • dyamic_cast<new_type>(expression)

  • converting base class —> derived class

8
New cards

constant cast

  • const_cast<new_type>(expression)

  • data type <—> constant

  • basically cheating, goes against the purpose of const

9
New cards

reinterpret cast

  • reinterpret_cast<new_type>(expression)

  • whats in memory addr —> new type

10
New cards

const

  • variable whose value never changes

  • prevents modifying BOTH ADDRESS AND VALUES stored in const pointers

  • const int datatype = value;

11
New cards

pass by reference

12
New cards

multi dimension arrays/double pointers

13
New cards

c style casting

14
New cards

classes: basic syntax

class ClassName {

public:

private:

protected:

};

15
New cards

classes: user defined constructors

you create the constructor to control how the obj is initialized rather than letting compiler give u the default one (may give u random values)

16
New cards

classes: this pointer

  • pointer in every class that points to current object that called the method

  • acc be able to assign the obj arributes to the obj to use them in methods

  • object’s attr = param attr (this → attr = attr) instead of attr = attr

  • *this = dereference/actual current obj

  • example1 :
    public:
    int x, y;

    Class* e = this;
    e→x = x;

    OR

    this→x = x;


    OR

    (*this).x = x;

  • used to:

    • resolve naming conflicts

    • return current obj for using multiple methods at once

    • passing current obj to other methods

17
New cards

classes: operator overloading

  • all operators can be manually overloaded

    • MyClass operatorX(const MyClass& other) const;

  • operators

    • operator+()

    • operator*()

    • operator«()

    • operator[]()

18
New cards

classes: destructors

  • auto called when obj gonna be destroyed

  • ~className();

  • ~className() {}

19
New cards

protected access specifiers

only can be accessed within the same class AND child classes

20
New cards

namespaces

  • used to avoid naming conflicts in big programs

  • allows things to have identical names AS LONG AS NAMESPACES ARE DIFF

  • to create a namespace

    • namespace Name{
      int var = smth;
      }

  • to access smth from certain namespace

    • Namespace::thing

  • NEVER USE using std namespace

21
New cards

c style casting

22
New cards

classes: copy constructors

23
New cards

classes: move constructors

24
New cards

templates