Module 5 Class Activity
Module 5 Class Activity
Class Activity
Module 5
1. Define the term Inheritance and give one example of class. (4 Marks)
Public ParentCat {
The Based class is the Parent class (main class) and the Derived class is the child class
(subclass). The derived class inherits attributes and behaviors from a based class.
An abstract class enables other classes to inherit from this class, but
forbids to instantiate. One can inherit from an abstract class but we
cannot create objects of an abstract class.
6. What is overloading? (1 Marks)
Method Overloading in C# is when you have two or more methods with the same name but
different signatures.
Syntax Errors:
Most Syntax errors are caused by mistakes that you make when writing code. Programming
language differ from the other programming languages so you can’t use the save syntax,
example you can’t use python format in java.
Run-time Errors:
Run-time errors are those that appear only after you compile and run your code.
Logic Errors:
A logic error (or logical error) is a mistake in a program's source code that results in
incorrect or unexpected behavior. For example, assigning a value to the wrong variable may
cause a series of unexpected program errors.
Method overriding is a feature that allows you to invoke functions (that have the same
signatures) that belong to different classes in the same hierarchy of inheritance using the base
class reference.