0% found this document useful (0 votes)
6 views8 pages

C++ Viva Points

Uploaded by

GAURAV MISHRA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views8 pages

C++ Viva Points

Uploaded by

GAURAV MISHRA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

C++ Viva Points

1. Object-Oriented Approach Introduction:

• The text introduces the Object-Oriented Approach, a programming paradigm that


revolves around objects, which encapsulate data and behavior.

2. Relating to Other Paradigms:

• The Object-Oriented Approach is discussed in relation to other programming


paradigms, such as functional programming and data decomposition.

3. Basic Terms and Ideas:

• Abstraction: The concept of simplifying complex systems by modeling classes based


on their essential features.

• Encapsulation: The bundling of data and methods that operate on that data into a
single unit, known as a class.

• Inheritance: The mechanism that allows a class to inherit properties and behaviors
from another class, promoting code reuse.

• Polymorphism: The ability of a class to take on multiple forms, often through


method overriding or interface implementation.

4. Review of C:

• Presumably, the text includes a review of the C programming language, which serves
as a foundation for understanding C++.

5. Difference between C and C++:

• Highlights distinctions between C and C++, emphasizing features like cin and cout for
input and output, as well as the new and delete operators for dynamic memory
management.

6. Object:

• An instance of a class in the Object-Oriented Approach. Objects represent real-world


entities and encapsulate both data and the methods that operate on the data.

7. Class:

• A blueprint or template for creating objects. Classes define the properties


(attributes) and behaviors (methods) that objects of the class will have.

8. Public:

• Members declared as public are accessible from anywhere in the program. They can
be accessed by objects of the class, as well as from outside the class.

9. Private:

• Members declared as private are not accessible from outside the class. They can
only be accessed within the class. Private members are encapsulated within the
class and are not visible to the external world.
10. Protected:

• Members declared as protected are similar to private members but have an


additional characteristic. They are accessible within the class and by derived classes.
Inheritance plays a crucial role here; a derived class can access protected members
of its base class.

11. Message Passing:

• In Object-Oriented Programming (OOP), communication between objects is


achieved through message passing. Objects interact by sending messages to request
or provide information.

12. Function Overloading:

• A feature in C++ that allows multiple functions with the same name but different
parameter lists, enabling flexibility and code readability.

13. Operator Overloading:

• Another feature in C++ that allows the definition of custom behaviors for operators
when applied to user-defined types or objects.

14. Dynamic Binding:

• The process in which the method or function call is resolved at runtime, enabling
polymorphic behavior through virtual functions in C++.

15. Memory Management:

• C++ introduces dynamic memory allocation and deallocation using new and delete
operators, providing more control over memory resources compared to C.

16. Classes and Objects:

• Encapsulation: The bundling of data (attributes) and methods that operate on the
data into a single unit, known as a class.

• Information Hiding: Restricting access to certain details of an object and revealing


only what is necessary for the outside world to interact with it.

17. Abstract Data Types:

• Using classes to create abstract data types, allowing the definition of data structures
and operations without specifying implementation details.

18. Object & Classes:

• Objects are instances of classes. Classes define the blueprint or template, while
objects are actual instances created based on that blueprint.

19. Attributes and Methods:

• Attributes: Variables that represent the state or properties of an object.

• Methods: Functions that define the behavior or actions that the object can perform.
20. C++ Class Declaration:

• Syntax and structure for declaring classes in C++, specifying attributes and methods.

21. State, Identity, and Behavior of an Object:

• State: The current values of an object's attributes.

• Identity: A unique identifier for each object.

• Behavior: The actions or operations that an object can perform.

22. Constructors and Destructors:

• Constructors: Special methods called when an object is created, used to initialize


object attributes.

• Destructors: Special methods called when an object is destroyed, used to clean up


resources.

23. Instantiation of Objects:

• The process of creating instances of a class, resulting in objects with their own set of
attributes and behaviors.

24. Default Parameter Value:

• Providing default values for function parameters, allowing flexibility when calling
functions.

25. Object Types:

• Different types of objects based on classes, each with its own state and behavior.

26. C++ Garbage Collection:

• C++ typically relies on manual memory management, and the term "garbage
collection" here may refer to the process of releasing unused memory, especially
when dynamic memory allocation is involved.

27. Dynamic Memory Allocation:

• Allocating memory for objects during runtime using operators like new and
managing memory deallocation using delete.

28. Metaclass/Abstract Classes:

• Metaclasses or abstract classes represent a higher level of abstraction. Abstract


classes cannot be instantiated and may contain abstract methods that must be
implemented by derived classes.

29. Inheritance:

• The mechanism that allows a class to inherit properties and behaviors from another
class. It promotes code reuse and supports the creation of a hierarchy of classes.

30. Polymorphism:
• The ability of a class to take on multiple forms. This can be achieved through
function overloading and overriding, enabling flexibility and adaptability in the code.

31. Access Specifiers:

• Keywords like public, private, and protected that control the visibility and
accessibility of class members.

32. Friend Functions:

• Functions that are not members of a class but have access to its private and
protected members. They are declared using the friend keyword.

33. Operator Overloading:

• The ability to redefine how operators work for user-defined data types, providing a
natural and intuitive interface for objects.

34. Static Members:

• Members (both variables and functions) that belong to the class rather than
instances of the class. They are shared among all objects of the class.

35. Copy Constructors:

• Special constructors used for creating a new object as a copy of an existing object.

36. Destructor Overloading:

• Overloading the destructor to handle different cleanup scenarios based on the


object's usage.

37. Inheritance and Polymorphism:

• Inheritance: A mechanism in object-oriented programming that allows a class to


inherit properties and behaviors from another class.

• Class Hierarchy: The organization of classes into a hierarchy, representing


relationships and specialization.

• Derivation – Public, Private & Protected: Different access specifiers for inheritance,
controlling the visibility of inherited members.

38. Aggregation:

• The association between objects where one object contains another object, but they
can exist independently.

39. Composition vs. Classification Hierarchies:

• Composition: Objects of one class are composed of objects of another class. The
composed objects do not exist independently.

• Classification: Organizing classes into a hierarchy based on similarities and


differences.

40. Polymorphism:
• The ability of a class to take on multiple forms, allowing flexibility and adaptability in
the code.

41. Categorization of Polymorphism Techniques:

• Different ways in which polymorphism can be implemented, such as compile-time


(static) and runtime (dynamic) polymorphism.

42. Method Polymorphism:

• Achieved through function overloading and overriding, allowing a method to take


different forms based on the context.

43. Polymorphism by Parameter:

• Designing functions or methods that can accept parameters of different types,


enabling flexibility in function calls.

44. Operator Overloading:

• Redefining how operators work for user-defined data types, providing a natural and
intuitive interface for objects.

45. Parametric Polymorphism:

• The ability of a function or a type to operate on values of different types, often


implemented through templates in C++.

46. Abstract Classes:

• Classes that cannot be instantiated and may contain pure virtual functions. They
serve as a blueprint for derived classes.

47. Pure Virtual Functions:

• Functions declared in an abstract class that have no implementation and must be


overridden by derived classes.

48. Interfaces:

• Abstract classes with only pure virtual functions, defining a contract that derived
classes must adhere to.

49. Late Binding/Runtime Binding/ Dynamic Binding:

• The process where the appropriate function or method is determined during


runtime, allowing for flexibility and polymorphic behavior.

50. Early Binding/Compile-time Binding/ Static Binding:

• The process where the appropriate function or method is determined at compile


time, providing efficiency but less flexibility compared to dynamic binding.

51. Virtual Functions:

• Functions marked as virtual in the base class to enable function overriding in derived
classes, facilitating polymorphic behavior.
52. Function Overriding:

• Replacing a virtual function in a base class with a function in a derived class with the
same signature.

53. Function Overloading:

• Defining multiple functions with the same name but different parameter lists,
providing versatility and improving code readability.

54. Diamond Problem:

• A challenge in multiple inheritance where a class derives from two classes that have
a common ancestor, potentially leading to ambiguity.

55. Static Polymorphism:

• Achieved through function overloading and templates at compile time, providing


efficiency but limited flexibility compared to dynamic polymorphism.

56. Dynamic Polymorphism:

• Achieved through function overriding and virtual functions, allowing flexibility and
adaptability at runtime.

57. Generic Function – Template Function:

• Generic Function: A function that can operate on different data types without
specifying the type explicitly.

• Template Function: A mechanism in C++ that allows the creation of generic


functions or classes using templates.

58. Function Name Overloading:

• Defining multiple functions in the same scope with the same name but different
parameter lists, enabling flexibility and enhancing code readability.

59. Overriding Inheritance Methods:

• Replacing the implementation of a method in a derived class with a new


implementation, providing a specialized behavior.

60. Run-Time Polymorphism:

• Polymorphic behavior that is determined during runtime, often achieved through


virtual functions and late binding.

61. Multiple Inheritance:

• A feature in C++ that allows a class to inherit from more than one class, enabling the
incorporation of features from multiple sources.

62. Files and Exception Handling:

• Persistent Objects: Objects whose state is stored and retrieved, allowing data to
persist across program executions.
• Streams and Files: Mechanisms in C++ for input and output operations, including
reading from and writing to files.

• Namespaces: A way to organize code and prevent naming conflicts by grouping


related code elements.

63. Exception Handling:

• A mechanism for handling errors and exceptional situations in a program, improving


its robustness.

64. Generic Classes:

• Classes that can work with different data types using templates, providing flexibility
and code reuse.

65. Function Templates:

• Templates in C++ that allow the creation of generic functions. Function templates
use placeholder types to work with various data types.

66. Class Templates:

• Similar to function templates, class templates allow the creation of generic classes
that can work with different data types.

67. Template Specialization:

• Providing a specific implementation for a template for a particular data type,


allowing customization for specific cases.

68. Explicit Specialization:

• Explicitly providing a specialized implementation for a specific template, overriding


the default behavior.

69. Dynamic Casting:

• A feature in C++ that allows the conversion of a pointer or reference to a base class
into a pointer or reference to a derived class at runtime.

70. File Handling Operations:

• Operations such as opening, closing, reading, and writing files in C++. Understanding
file modes, error handling, and file positioning.

71. Try-Catch Blocks:

• Exception handling mechanism in C++ where code within the "try" block is
monitored for exceptions, and the "catch" block handles the exceptions that occur.

72. Throwing Exceptions:

• Explicitly throwing exceptions using the throw keyword when an error or


exceptional situation is encountered.

73. Standard Template Library (STL):


• A powerful set of C++ template classes and functions that provide general-purpose
classes and algorithms with templates.

74. Inheritance and Virtual Functions Recap:

• Reinforcing the importance of proper design in inheritance hierarchies, using virtual


functions to achieve dynamic polymorphism.

You might also like