Unit-3 Access Specifiers OOPs using C++ | BCA 2nd Year 2023
Unit-3 Access Specifiers OOPs using C++ | BCA 2nd Year 2023-Hello everyone welcome to the pencilchampions.com website this website provide unit 3 object oriented Programming notes In BCA Student Year 2023. Thankyou for visiting pencilchampions.com
Access Specifiers
- There are three access specifiers – public, private and protected. These access specifiers define how any member of a class can access a class, making it accessible from within any member function of the same class within that slave.
Read External link–https://www.studocu.com/in/document/anna-university/object-oriented-programming/oops-unit-3-part-1-inheritance-and-exception-handling/22425519
There are 3 types of access specifiers
- Public- Members declared as public are accessible from outside the class through any object of the class.
- Protected – Access to members declared as protected is possible from outside the class, but only if the class is derived from Lit.
- Private These members can only be accessed from within the class, no external access is allowed.
Read more-https://pencilchampions.com/unit-1-introduction-to-object-programming-in-c-bca-2nd-year/
- Unit-2 oops-Â https://pencilchampions.com/unit-2-inheritance-in-oops-using-c-bca-3rd-semester/
Multilevel Inheritance
- In multilevel inheritance, a class inherits the properties of another derived class.
- In the figure below, Class B and Class A are as parent classes based on retention relationship. The level of inheritance extended to any level. It is possible
Hierarchical Inheritance
- In this type of inheritance more than one subclass inherits from the same base class. More than one derived class inherits from the same base class.
Polymorphism
- Polymorphism is the ability to use an operator or method in different ways. Polymorphism gives different meanings or functions to operators or methods.
There are two types of polymorphism
- Types of Compile Time Polymorphism
- Run Time Polymorphism
Compile time polymorphism
- Function overloading
- Operator overloading
- Run time polymorphism- function overriding/virtual functions.
Function overloading
- Function overloading refers to using the same thing for different purposes. This process of having “same name but different in signature” functions is called function overlanding.
- From the point of view of the type of argument. In the thirteenth of the number of arguments.
Function Overriding
- If the derived class function name is same as the base class member function with same arguments then it is called overriding. as a function
Operator overloading
- C++ also provides option to overload operators.
- For example- we can create string class with operator’+’ to concatenate two strings. We know that it is addition operator whose function is to add the operands between integer operands when adding them with single operator and to add them when placing them between string operands.
Discover more from Pencil Champions
Subscribe to get the latest posts sent to your email.