Oops interview questions12/27/2023 ![]() ![]() Every change to a base class will likely cause the changes of its derived classes. In Object Oriented Programming, inheritance is the strong coupling. When a class makes an instance of another class then that class is said to have dependency on another class. ![]() The measure of the degree of dependency of Y on X or coupling can be strong or weak. Here, a component can be a class, a function, an interface, a method or even a field. If component X changes, then Y should change accordingly. What is Dependency?ĭependency means say component Y is dependent on component X. Foo IS-A Bar:Ī HAS-A relationship is dynamic (run time) binding while IS-A relationship is a static (compile time) binding. Composition means creating instances which have references to other objects. On the other hand, HAS-A relationship is composition. This means, that the child class is a type of parent class. In OOP, IS-A relationship is completely inheritance. What is the meaning of "IS-A" and "HAS-A" relationship? This depends on the language, the language version, libraries, and configuration. This function can have different implementations. When you create new class, it will call an allocation function. If a class have multiple objects they can have different unique memory location. ![]() So to an object of an empty class, 1 byte is allocated by compiler, for it's unique address identification. The memory allocation takes place only when you create objects because the objects is what implements the contents of the class. How much memory does a class occupy?Ī class without an object requires no space allocated to it. Here, we have prepared the important object-oriented programming Interview Questions and Answers, which will help you succeed in your interview. In fact, the OOPs model is so popular, that many of the most widely used programming languages support and use this Object Oriented Programming or OOPs model, such as Java, C++, Python, C#, etc. The concepts of Object Oriented Programming are the basis for many of today's programming languages. Object Oriented Programming Interview Questions ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |