Question

In: Computer Science

Questions related to C#. When you build a class in C#.NET, how many sub classes can...

Questions related to C#.

When you build a class in C#.NET, how many sub classes can inherit from the class that you just built?

In Object Oriented Development, there are 3 primary concepts that define Object Oriented Programming. What are these concepts?

Function/Method Overloading is when you build 2 or 3 functions with the same name but different argument lists. T/F?

Solutions

Expert Solution

1. When you build a class, if it is the base class, it is also calles super class.It is the ancestorial class. All the other class are derived from the base class.

A super class can have any number of subclass.While comming to iherritance, the single inherritance the class have only one subclass, but as we go further to multilevel or multiple inherritance, a class can have many sub classes. But a subclass should only have one super class.

2. Three primary Concepts of OOP

The three primary concepts of Object Oriented Programming are :

Encapsulation

Encapsulation is nothing but wrapping up of data or functions into a single unit.The unit contains large processings or functions.But they are shown as a single entity.

eg : A Calculator

Inherritance

  Inheritance is a mechanism in which one class acquires the property of another class. For example, a child inherits the traits of his/her parents. With inheritance, we can reuse the fields and methods of the existing class.

eg : Ancestorial inherritance

Polymorphism

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.

eg : you have a smartphone for communication. The communication mode you choose could be anything. It can be a call, a text message, a picture message, mail, etc. So, the goal is common that is communication, but their approach is different. This is called Polymorphism.

3. TRUE ,  Function Overloading is nothing but the function with same name but different argument or parameters.

An example in C is :

int Volume(int s)

{

return s * s * s;

}

double Volume(double r, int h)

{

return 3.1415926 * r * r * static_cast<double>(h);

}

long Volume(long l, int b, int h)

{

return l * b * h;

}

  In the above example, all the functions have the same name volume, but the parameters are different.


Related Solutions

How can you build conceptual knowledge related to the 10 themes in social studies for your...
How can you build conceptual knowledge related to the 10 themes in social studies for your students? Share two examples.
Explain how it is that we build the “processRequest()” method in a Servlet class, when the...
Explain how it is that we build the “processRequest()” method in a Servlet class, when the Servlet interface requires us to write 3 methods(init(), service() and destroy()). Why don’t we have to build these 3 methods?  
Explain how it is that we build the “processRequest()” method in a Servlet class, when the...
Explain how it is that we build the “processRequest()” method in a Servlet class, when the Servlet interface requires us to write 3 methods(init(), service() and destroy()). Why don’t we have to build these 3 methods???
Questions 6-10 are related to the following As a statistics course assignment you are to build...
Questions 6-10 are related to the following As a statistics course assignment you are to build a 95% confidence interval for the mean monthly rental for two-bedroom apartments in Marion County. A random sample of 80 apartments yields the following data. 840 1550 560 1080 970 1560 830 1220 1390 1110 920 1150 1600 1310 610 1590 1100 720 720 1350 1020 1290 710 600 830 1190 1170 1470 1320 730 800 840 1130 690 900 1520 1050 1220 1400...
What are the equivalence classes for a ∗ b ∗ ? • How many equivalence classes...
What are the equivalence classes for a ∗ b ∗ ? • How many equivalence classes are there? • Make each one into a state and show how one can construct a minimal deterministic finite automaton from them. • Explain how to choose the start state and accepting states and how to draw the arrows. • The resulting automaton is minimal for this language. How about for {a n b n : n ≥ 0}? What are the equivalence classes?
4. Assume that the repetition is not allowed. How many orders that can be build from...
4. Assume that the repetition is not allowed. How many orders that can be build from 6 numbers, 2, 3, 4, 5, 7 and 9, taken 3 at a time, to produce any number in hundreds, a) Without any condition b) Produce values less than 400. c) Produce the even values. d) Produce the odd values. e) Produce values that are the multiple of 5.
For the following two questions you need to provide a code in C 1. Build a...
For the following two questions you need to provide a code in C 1. Build a double linked list with 5 in the first node following the instructions: Insert a node with 3 at the top of the list Insert a node with 10 at the bottom of the list Insert a node with 7 between nodes with 5 and 10 2. Start deleting nodes from the list in the following order; Delete the node with 7 Delete the node...
How can the classes be modified to satisfy the comments & example tester: public class InvalidIntegerException...
How can the classes be modified to satisfy the comments & example tester: public class InvalidIntegerException extends Exception{ // Write a class for an InvalidIntegerException here //Constructor that takes no arguments public InvalidIntegerException (){ super(); } //Constructor that takes a string message public InvalidIntegerException (String message){ super(message); } } import java.io.InputStream; import java.io.IOException; public class Parser { private InputStream in; public static final int CHAR_ZERO = (int) '0'; public Parser (InputStream in) { this.in = in; } // Complete the...
How can the classes be modified to satisfy the comments: public class InvalidIntegerException extends Exception{    ...
How can the classes be modified to satisfy the comments: public class InvalidIntegerException extends Exception{     // Write a class for an InvalidIntegerException here     //Constructor that takes no arguments public InvalidIntegerException (){ super(); } //Constructor that takes a string message public InvalidIntegerException (String message){ super(message); } } import java.io.InputStream; import java.io.IOException; public class Parser { private InputStream in; public static final int CHAR_ZERO = (int) '0'; public Parser (InputStream in) { this.in = in; } // Complete the following...
C#. Build a class that will be called “MyDate”. The class should have 3 properties: month,...
C#. Build a class that will be called “MyDate”. The class should have 3 properties: month, day and year. Make month, day and year integers. Write the get and set functions, a display function, and constructors, probably two constructors. (No Database access here.)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT