Week 9 Flashcards
Naming a file or a variable is the first and the very basic step that a programmer takes to write clean codes, where naming has to be appropriate so that for any other programmer it acts as an easy way to read the code. In C++, naming conventions are the set of rules for choosing the valid name for a variable and function in a C++ program.
Naming Convention
Advantages of naming Conventions
*Avoids naming conflicts.
*Improves clarity of the code in case of ambiguity.
*Helps to formalize and promote consistency within a team.
*Improves understanding and readability of the code.
This is a style where words within a name are capitalized, except the first word.
Camel Case
also known as Upper Camel Case): This is a style where each word in a name begins with a capital letter, including the first word.
Pascal Case
(also known as Lowercase with underscores): This is a style where words within a name are separated by underscores and all letters are lowercase.
Snake Case
is a variation of snake_case, where all letters are uppercase and words are separated by underscores (_).
Screaming Case
pointers is a pointer to the current instance of a class. It is used to refer to the object within its own member functions.
This -> Notation
is an implicit pointer available within non-static member functions of a class or structure. It points to the current object instance, letting the object access its own member variables and functions.
This -> Notation
pointer can also be used as a constructor, a special member function that is called when an object of the class is created.
This -> Notation
pointer is used to refer to the object that is being created.
This -> Notation
The capability of a class to derive properties and characteristics from another class is called _________
Inheritance
is one of the most important features of Object Oriented Programming in C++
Inheritance
It allows us to create a new class (derived class) from an existing class (base class). The derived class inherits the features from the base class and can have additional features of its own.
Inheritance
if we derive a subclass from a public base class. Then the public member of the base class will become public in the derived class and protected members of the base class will become protected in the derived class.
Public Inheritance Mode
If we derive a subclass from a Protected base class. Then both public members and protected members of the base class will become protected in the derived class.
Protected Inheritance Mode
If we derive a subclass from a Private base class. Then both public members and protected members of the base class will become private in the derived class. They can only be accessed by the member functions of the derived class.
Private Inheritance Mode
a class is allowed to inherit from only one class. i.e. one base class is inherited by one derived class only.
Single Inheritance
is a feature of C++ where a class can inherit from more than one class. i.e one subclass is inherited from more than one base class.
Multiple Inheritance
In this type of inheritance, a derived class is created from another derived class and that derived class can be derived from a base class or any other derived class. There can be any number of levels.’
Multilevel Inheritance