Please upvote if you are able to understand this and if there is any query do mention it in the comment section.
Dynamic data types are those data types are dynamic in nature and there is no need to initialize the dynamic variable when it is declared and also there is no need to write a specific data type while defining it. A dynamic data type can be declared with the help of dynamic keyword as:
dynamic x = 1;
Role of CLR in .Net:
When the program is compiled by the user then the CLR comes into play converting the code into a code which can understandable by the machine and then the code is executed and the output is given to the user. CLR also provides some services like managing the memory, managing the threads etc. which are useful for the implementation of the code or the program.
Abstract classes:
This is a class which cannot be used to make objects and this class is always required to be inherited from some other class in order to implement it. Example:
CODE:
using System;
class HelloWorld {
static void Main() {
example ex;//creating an object of class object
ex = new otherExample();
ex.num();//calling the method with the object
}
}
public abstract class example {//creating an abstract
class
public abstract int num();//creating an abstract method
}
public class otherExample : example {//inheriting the abstract
class
int n = 2;
public override int num() {//overriding the abstract method
Console.WriteLine(n);//printing the value of n
return n;
}
}
OUTPUT:
Overloadable operators:
An overloadable operator is like a function which have a special name written with the keyword operator and after that the symbol is defined for that operator. When the operator has to be overloaded then the return type has to be mentioned alongwith the parameters.
Some overloadable operators can be: +, -, ~, /, % etc.
Non-overloadable operators:
All the operators in C# cannot be overloaded and those operators are non-overloadable operators.
Some non-overloadable operators can be: &&, +=, -=, %=, /= etc.
Ways of passing parameters to a method in C#:
Output parameters: There is criteria that only one value can be returned with the help of return keyword but with the help of output parameters more than multiple values can be returned from a function. This is used when the initial values for the parameters is not defined and the function has to return a value.
Reference parameters: There is a parameter and with the help of reference parameters the values of those parameters can be copied to the memory location of an argument of the function.This is used when there is modification to be made only in the calling function.
What is dynamic data type in C#? How to declare a dynamic data type? Describe in...
Which of the following are ways to declare a new data type in C++? more than 1 choice is accepted A. There is no need to declare the data type in C++ B. Using the new keyword C. Create an alias using typedef D. Create a new type by using class or struct. E. Create an extension of an existing type using inheritance. F. Using the auto keyword QUESTION 6 When an object is copied by assigning each of the...
write in C++ polynomial class that the data type of the coefficients is a template parameter. This data type can be any type that has operators for addition, subtraction multiplication and assignment. The class should have a default constructor which results in a zero value. For example our template class would allow us to build polynomails where coefficients are complex numbers ( using the complex<double> type < complex>)
List of Candles Create a class called CandleNode which has fields for the data (a Candle) and next (CandleNode) instance variables. Include a one-argument constructor which takes a Candle as a parameter. (For hints, see the PowerPoint on "Static vs. Dynamic Structures”.) public CandleNode (Candle c) { . . } The instance variables should have protected access. There will not be any get and set methods for the two instance variables. Create an abstract linked list class called CandleList. This...
(1) Imagine you want to change someone's attitude on what car to purchase. Describe how you would (2) In the Yale Attitude Change approach, there are three u wantedcomponents to attitude change. form your arguments if you Chapter 7 to use central and peripheral routes Identify and describe these three of persuasion. Which type of persuasion would lead to long- lasting attitude change? parts of the model. Then state the major criticism of this model. (3) After the Milgram study,...
PRG/421 Week One Analyze Assignment – Analyzing a Java™Program Containing Abstract and Derived Classes 1. What is the output of the program as it is written? (Program begins on p. 2) 2. Why would a programmer choose to define a method in an abstract class (such as the Animal constructor method or the getName()method in the code example) vs. defining a method as abstract (such as the makeSound()method in the example)? /********************************************************************** * Program: PRG/421 Week 1 Analyze Assignment * Purpose: Analyze the coding for...
Question 1 If a method is marked as protected internal, who can access it? Classes that are both in the same assembly and derived from the declaring class. Only methods that are in the same class as the method in question. Internal methods can only be called using reflection. Classes within the same assembly, and classes derived from the declaring class Question 2 To avoid having to use fully qualified referenced classes, you could: Add a reference to the class....
Y. Daniel Liang’s 8 Class Design Guidelines were posted on the File Manager and handed out in class. Please choose 5 guidelines and discuss them in depth. For each guideline, use 1 page or more for your discussion. You can use the code provided in class to demonstrate your points. The code should not be more than one-third of your writing. 1. Cohesion • [✓] A class should describe a single entity, and all the class operations should logically fit...
You must write C# classes which are used to manage product review data for Books and Cars. You will write an abstract class called Review which abstracts common properties (review rating and comments). You will then create an Interface responsible for the functionality to display the Reviewcontent. Then, you will create 2 concrete classes which inherit from Review and implement the Interface. Finally, you will create console applicationwhich will create 2 CarReview instances and 2 BookReview instances and display them...
Lab 2: (one task for Program 5): Declare an array of C-strings to hold course names, and read in course names from an input file. Then do the output to show each course name that was read in. See Chapter 8 section on "C-Strings", and the section "Arrays of Strings and C-strings", which gives an example related to this lab. Declare the array for course names as a 2-D char array: char courseNames[10] [ 50]; -each row will be a...
Q1) How would you declare an array of doubles called myDoubles? Arrays can be initialized in one of two ways. In one method, the array elements are placed in a list enclosed in curly braces after the array name definition. For example, the code below creates an array of ints with 3 elements: 1, 2 and 3. int[] a = {1, 2, 3, 4}; We can also initialize an array with a new construct, indicating how many elements we want...