OOPS Concepts - amitbhilagude/userfullinks GitHub Wiki
• Difference between Struct and class
○ C++ : access level is private in class and public in struct
○ C#: access level is private for both however struct is value type and class is reference type
• Finalize and Dispose
§ Dispose called by user code and not to wait for garbage collection for resource like database connection, file stream etc.
§ Finalise called by garbage collector
• Static constructor
§ Invokes automatically runtime and it invokes only once. If there is static constructor and static data field like class object etc. Data fields invokes first.
• Single tone design pattern
§ It initialize only once
§ It will be inherited and interface
§ Coding best practice with file 003_singletone.cs
§ Access modifier: internal, protected, protected internal, Partial etc
§ Primitive or Non primitive and ref
Primitive type inherited from object class. ToString is available due to object class.
§ Inheritance : super class obj from subclass
§ Destructor and gc collect
§ Static class must have static methods
• Static method
§ Base keyword
§ Data abstractions
○ Representation of main features and view to simplify database design
§ Encapsulation: data hiding and protection
○ e.g. selling burger with 5$, 8$, 12$ , create Property : heavy calculation do in set not in get
§ Modular approach: break program in small pieces as module and work as expected if one module not required e.g. motherboard works 1- 2 ram.
§ PROBLEM with multilevel inheritance: doesn't work as modular approach solutions is interface.
§ Using Keyword, IDisposable interfaces and dispose method
§ Polymorphism: Same thing and different kind. E.g Animal base class and derived class is dog with talk override
Class inherited from base class
Base class method is override keyword with derived class using virtual keyword
○ Generic class: type of polymorphism, allow you use any data type. Templates
Why not object? Templates has better performance.
Abstract vs Interface : options for polymorphism
§ Object Oriented Programming
• https://www.geeksforgeeks.org/oops-object-oriented-design/