Category Archive for: Inheritance

Interfaces

As mentioned earlier, by deriving from an interface, a class is declaring that it implements certain functions. Because not all object-oriented languages support interfaces, this section examines C#’s implementation of interfaces in detail. Developers familiar with COM should be aware that, although, conceptually, C# interfaces are similar to COM interfaces, they are not the same thing. The underlying…

Read More →

Modifiers

You have already encountered quite a number of so-called modifiers – keywords that can be applied to a type or to a member. Modifiers can indicate the visibility of a method, such as public or private, or the nature of an item, such as whether a method is virtual or abstract. C# has a number of modifiers, a.nd…

Read More →

Implementation Inheritance

If you want to declare that a class derives from another class, use the following syntax: class MyDerivedClass : MyBaseClass { II functions and data members here This syntax is very similar to C++ and Java syntax. However, C++ programmers, who will be used to the concepts of public aPldprivate inheritance, should note that C# does…

Read More →

Types of Inheritance

Let’s start off by reviewing exactly what C# does and does not  support as far as inheritance is concerned. Implementatlon versus Interlace Inheritance In object-oriented programming, there are two distinct types of inheritance – implementation inheritance and interface inheritance:  implementation is to be oven. This type of inheritance is . most useful when you need to add functionality…

Read More →

Inheritance

“Objects and Types,” examined how to use individual classes in C#. The focus in that chapter was how to define methods, constructors, properties, and other members of a single class (or a single struct). Although you did learn that all classes are ultimately derived from the class System. Object, you did not see how to create a hierarchy…

Read More →

Back to Top