Question

1 What is a difference between override and new when it comes to inheritance? 2 What...

1 What is a difference between override and new when it comes to inheritance?

2 What is the difference between List<type> and ArrayList? AND Which one should you use and why?

3. If I have a file test.txt, and have committed it to the git repository using: $ git commit test.txt Then made some changes, what command (or option) do you use to get the original file back (ie restore the contents of the committed file)?

4 What command (or option) do you use to initialize a directory as a git repository?

5. List 2 decentrialized source code managment systems

6. What is the purpose of source code management systems?


7. Would this code work? Why or why not?

intval = 5;
Textbox1.Text = val;

8.... Create an example where you have a base class A and a derived class B. class A has a method called func which has the following prototype – 3pt:

public virtual void func()

Create class B such that it replaces the functionality of the func method with new functionality.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

Override: When a method of a base class is overridden in a derived class, the version in the derived class is used, even if the calling code didn't "know" that the object was an instance of the derived class.

New: If you use the new keyword instead of override, the method in the derived class doesn't override the method in the base class, it merely hides it.

2)

-> There's no difference between list implementations in both of your examples. There's however a difference in a way you can further use variable myList in your code.

-->When you define your list as:

-->List myList = new ArrayList();

-->you can only call methods and reference members that are defined in the List interface. If you define it as:

-->ArrayList myList = new ArrayList();

--> you'll be able to invoke ArrayList-specific methods and use ArrayList-specific members in addition to those whose definitions are inherited from List.

--> Nevertheless, when you call a method of a List interface in the first example, which was implemented in ArrayList, the method from ArrayList will be called (because the List interface doesn't implement any methods).

3)

$ git reset --soft HEAD^
        $ ... do something else to come up with the right tree ...
        $ git commit -c ORIG_HEAD

4)git-init-db(1) ============== NAME ---- git-init-db - Creates an empty Git repository SYNOPSIS -------- [verse] 'git init-db' [-q | --quiet] [--bare] [--template=] [--separate

5)

DELTA BASED VERSION CONTROL

SNAPSHOT BASED VERSION CONTROL

6)

  • Using revision control software, a programmer or team of programmers may use several approaches for software development.
  • Locally, developers must all use the same computer system, which may be the revision control system.
  • In a distributed model, developers work directly with a local repository, where their individual source code revisions are collected.
  • The developers then update the central repository with their local revisions so that revisions can be shared among developers.

7)Not work.

Because, we can store an int value in a variable of type int. But we can't store a int value to a text file. It won't work anyway.

8)

public clsas A{

public vertual void func( ) { }

}

public clsas B : A{

public override void func( ) { }

}

Add a comment
Know the answer?
Add Answer to:
1 What is a difference between override and new when it comes to inheritance? 2 What...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Boot into your Linux partition (or open Linux in a VirtualBox VM). You will create a...

    Boot into your Linux partition (or open Linux in a VirtualBox VM). You will create a new directory in your home directory called csci2020u/lab02. We’ll add this folder to the Git repositories. Use the following steps to complete this lab: 1. Change into the csci2020u directory 2. Make a new directory, called lab02 3. Add the lab02 directory to Git 4. In the lab02 directory, create the directory structure used by Gradle (the files will be initially empty, you can...

  • Homework 2: Avatar Cosmetic Description Use Decorator Pattern to design a command-line based avatar customization system...

    Homework 2: Avatar Cosmetic Description Use Decorator Pattern to design a command-line based avatar customization system for a game. The user shall select an avatar from two options: a male and a female. The user shall select various cosmetics for the avatar, including: Jacket T-shirt Jeans Shorts Sunglasses Running Shoes The system shall display the description of the avatar at the end of the customization. Example UI Welcome to the Avatar 1.0 System! Please select a cosmetic for your character:...

  • give notes to what each look like and description in text form Lab#1 –Learning Some Basics...

    give notes to what each look like and description in text form Lab#1 –Learning Some Basics applied Skills We have completed our initial install of Ubuntu and begun to feel our way around our new system. The following assignment will help you familiarize yourself with your new environment. Please use your system to test answer the following questions. After you have logged in and opened a term window... SECTION I: Simple Navigation of the file system 1. Use df command...

  • 1. Explain the difference between the /etc/profile and the ~/.bash_profile file. Which one is executed first?...

    1. Explain the difference between the /etc/profile and the ~/.bash_profile file. Which one is executed first? 2. Edit your .bash_profile file as follows: 1. Welcome the user 2. Add your home directory to the path if it is not there 3. Set erase to the Backspace key using stty. 4. Type source .bash_profile. What is the function of the source command? 3. What is the default primary prompt? 1. Change the prompt to include the time of day and your...

  • Assignment Requirements I have also attached a Class Diagram that describes the hierarchy of the inheritance...

    Assignment Requirements I have also attached a Class Diagram that describes the hierarchy of the inheritance and interface behaviors . The link to the PDF of the diagram is below MotorVehical.pdf Minimize File Preview User Define Object Assignment: Create a Intellij Project. The Intellij project will contain three user defined classes. The project will test two of the User Define Classes by using the invoking each of their methods and printing the results. You are required to create three UML...

  • Purpose Demonstrate the ability to create and use subclasses and inheritance. This includes overriding method behaviors...

    Purpose Demonstrate the ability to create and use subclasses and inheritance. This includes overriding method behaviors and using polymorphism. Assignment Create an Aircraft class that has several properties that are common to all aircraft (Ex: number of engines, seat capacity). You define the name of the Class and the actual fields. The fields MUST BE PRIVATE!!! You must define a constructor that allows you to provide at least some of the field values used for an aircraft. You must define...

  • do numbers 4-8 4. Given any directory, use the Is command to display: • all files...

    do numbers 4-8 4. Given any directory, use the Is command to display: • all files and sub-directories starting with the letter "D" (note do not list anything in any sub-directory) • its immediate sub-directories (sub-directories only, and no other ordinary files) its immediate hidden sub-directories only - take a screenshot (#3-3) that clearly shows the command and the result. 5. Assume that the following files are in the working directory: $ ls intro notesb ref2 section 1 section3 section4b...

  • What if you had to write a program that would keep track of a list of...

    What if you had to write a program that would keep track of a list of rectangles? This might be for a house painter to use in calculating square footage of walls that need paint, or for an advertising agency to keep track of the space available on billboards. The first step would be to define a class where one object represents one rectangle's length and width. Once we have class Rectangle, then we can make as many objects of...

  • 1. What is the difference between 1-mode and 2-mode graph? Give an example for each. 2....

    1. What is the difference between 1-mode and 2-mode graph? Give an example for each. 2. List various graph data structures to store social network information. 3. What is “six degrees of separation” in the context of social networks? What is the average degree of separation for Facebook and Twitter (you can cite other studies that have reported these statistics)? 4. What is “strength of weak ties”? Explain the rationale behind this phenomenon. 5. List and describe the various centrality...

  • java In this project you will implement a trivia game. It will ask random trivia questions, evaluate their answers and keep score. The project will also have an administrative module that will allow f...

    java In this project you will implement a trivia game. It will ask random trivia questions, evaluate their answers and keep score. The project will also have an administrative module that will allow for managing the question bank. Question bank management will include adding new questions, deleting questions and displaying all of the questions, answers and point values. 2. The project can be a GUI or a menu based command line program. 3. Project details 1. Create a class to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT