Chapter 7 Flashcards
What are properties
It allows us to access class members in a protective manner.
What are indexers
Its a feature of C# language that allows to behave any class of C# like an array. It means the instances of that class can be called like [ ] (indexes could be integer or string)
What is the difference between struct and class
stuct are value type and class is reference type. In struct we can not inherit implementation. There are no default constructor and destructors in struct.
What is the difference between value type and reference type
Reference type have copies and value type there is no copy and original stuff moves
What are interfaces
Interface is declaration of methods and properties. There is no implementation of it. e.g. test() { // no code here, only method signature }
How to declare an interface
interface IMyInterface { void MethodToImplement(); }
What are 4 things an interface have
Events
Indexers
Properties
Methods Implementation
Can one interface inherit another interface
Yes