1) From the C# code shown below identify each Ellipse ( Ellipse lite1, Ellipse l
ID: 3713714 • Letter: 1
Question
1)
From the C# code shown below identify each Ellipse ( Ellipse lite1, Ellipse lite2, Ellipse lite3) variable scope level. The format of your answer should be: lite1 (scope type), lite2 (scope type), lite3 (scope type).
public partial class MainWindow : Window
{
Ellipse lite1;
public MainWindow()
{
Ellipse lite2;
if (true)
{
Ellipse lite3;
}
}
}
2)
From the C# code shown below identify the statements where the different types of methods are being called static, non-static, and constructor. The format of your answer should contain the full statement: static (statement), non-static (statement), constructor (statement).
public partial class MainWindow : Window
{
Ellipse lite1;
public MainWindow()
{
Ellipse lite2;
lite1 = new Ellipse();
blinker.blink();
lite1.blink();
lite1.color = "Red";
if (false)
{
Ellipse lite3;
}
}
}
3) Define the usage of the following access modifiers: public, private, protected, and sealed. Your answer should only be one sentence long for each.
Explanation / Answer
1. Below is your scope levels
lite1 (Class level scope), lite2 (Method Level Scope), lite3 (Nested Scope).
2.
static (Ellipse lite1)
non static( blinker.blink();
lite1.blink();)
constructor( lite1 = new Ellipse();)
3.
public: - This access modifier states that the property or method can be accessed from anywhere, i.e. from outside the class as well.
private: - The property with private access modifier states that, it can be accessed only within the class.
protected: - This can be accessed within the class and within the inherited child classes.
sealed: - It protects the class from being inherited. i.e if a class is sealed, no other class can inherit it.
Your Question 2 was little ambiguous, Please let me know in comments if my understanding of your question is wrong. I'll surely help
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.