I personally feel: Through the implementation of practice data structure in different languages, you can quickly familiarize yourself with the new language language to learn about each other. Nested classes in the Java class can be a field in the class, and you can directly access other fields directly in the nested class, and the Field in the nested class is also exposed outside! And in the C # love is different from Java, and there is no C Friend keyword! How to do? I saw a website name "Data Structures and Algorith WITH OBJECT-Oriented Design Patterns", and the source code implemented by C , Java, C # data structure, see the definition of others: Take LinkedList as an example: //// This file contains the C code from Program 4.9 of // "Data Structures and Algorithms // with Object-Oriented Design Patterns in C " // by Bruno R. Preiss.//// Copyright (c) 1998 by Bruno R. Preiss , P.Eng. All rights reserved./// http://www.pads.uwaterloo.ca/bruno.preiss/books/opus4/Programs/pgm04_09.cpp/Template
Template
Listelement (T Const &, Listelement *); Public: T Const & Datum () Const; Listelement Const * Next () Const;
Friend LinkedList
Template
LinkedList (LinkedList Const &); LinkedList & Operator = (LinkedList Const &);
Listelement
Void Prepend (T Const &); Void Extract (T Const &); Void Purge (); Void InsertAfter (Listelement
Public final class element // Nested, using private modifications should also be {Object Datum; ELECT NEXT;
ELEMENT (Object Datum, Element Next) {this.datum = DATUM; this.next = next;}
Public Object getdatum () {return Datum;}
Public element getnext () {return nEXT;} // ...} // ...}
//// this file contains the c # code from program 4.12 of // "Data Structures and algorithms //" b j / c c # # c # Bruno R. Preiss, P.Eng. All rights reserved.// Note: The history of C # has been a few years! Haha! // http://www.pads.uwaterloo.ca/bruno.preiss/books/opus6/Programs/pgm04_12.txt/public class link; protected element head; protected element tail;
Public Sealed Class Element // Keyword Sealed is similar to Java's Final, but final features! {INTERNAL LinkedList List; // Keyword INTERNAL INTER OBJECT DATUM; Internal Element Next
INTERNAL ELEMENT (LINKEDLIST LIST) {this.list = list; this.datum = DATUM; THIS.
Public Object Datum;}} public element next {get {return next;}} // ...} // ...}
URL: http://www.brpreiss.com/ There is an online document on its website, as well as a relationship between individual classes and interfaces. I have a little effort to take some effort, I am working hard! I think we can also learn how to organize class, interface, and language. You can also contact Pattern's thoughts when you learn the data structure, why not! If you are familiar with the data structure, you can download the source code directly, and when you review!