PDF Notes: Chapitre 3 cpp

    Master this deck with 10 terms through effective study methods.

    Generated from uploaded pdf

    Created by @sira_hx

    What is encapsulation in object-oriented programming?

    Protects data by restricting access from outside the class.

    How do friend functions differ from regular functions?

    They can access private and protected members of a class.

    What happens if encapsulation is too strict?

    It can hinder necessary access to data for calculations.

    What is a friend function?

    A function that is not a member of a class but can access its private data.

    When should friend functions be used?

    When access to private data is essential without creating circular dependencies.

    What is a class friend?

    A class that can access all private members of another class.

    What is the implication of using friend functions?

    They can reduce data protection by violating encapsulation principles.

    What is the keyword used to declare a friend function?

    friend

    What is the purpose of a forward declaration in C++?

    To inform the compiler that a class exists before its full definition.

    What is the role of public methods in accessing private data?

    They provide a controlled way to access private members.