Pregunta de entrevista de Synechron

Static class, private constructor. Memory - heap & stack. Polymorphism, encapsulation.

Respuesta de la entrevista

Anónimo

11 de may de 2020

Static class: Like a static object inside a non-static class, the static classes don't need to be instantiated before using its members i.e. calling methods, using variables, and properties, remember if a class is marked as static we can't have any non-static member inside including constructor. Private constructor: Private constructors are generally used to lock the instantiation from outsiders, we can still create an object from a local member. Memory heaps & stacks: The memory heaps and stacks are used to store the types, the heaps are used to store the reference types, and stacks are used to store the value types, above this definition the memory heaps deep inside use the stacks to store the values including its address. Polymorphism: The polymorphism as the name indicates one name different form, in the OOPs when we inherit some virtues from the base class and extend inside the child class it becomes crucial to call the right method from the right object, in that case, the type of instance becomes important to call right member. Encapsulation: Is simply putting the values together into one object to send or use anywhere in the code.