The document provides an overview of HTML 5 tables, forms, and frames. It contains 7 sections that cover:
1. Simple and complete HTML 5 tables, including header, footer and body sections.
2. Form fields like text boxes, buttons, checkboxes and select fields. It also discusses labels, fieldsets and validation.
3. 際際滷rs, spinboxes and number inputs.
4. Frames which allow splitting pages into multiple views using the <frameset>, <frame> and <iframe> tags.
The document concludes with providing examples and homework assignments related to creating tables, forms and frames using HTML 5.
This document discusses JavaScript objects and object-oriented programming (OOP) in JavaScript. It introduces the author and defines JavaScript as an object-oriented language, noting that everything in JavaScript besides five primitive types (Number, String, Boolean, undefined, null) is an object. It describes creating user-defined objects using the new Object() constructor, functions as objects, object methods, and object literals - a lightweight syntax for creating objects. Examples are provided for each concept to illustrate OOP techniques in JavaScript.
This document discusses files and streams in C++. It explains that the fstream library allows reading from and writing to files using ifstream, ofstream, and fstream objects. It covers opening, closing, writing to, and reading from files, noting that files must be opened before use and should be closed after. The standard openmode arguments and open(), close(), write, and read syntax are provided. Examples of reading from and writing to files are included.
Pointer to Class & Object
This document discusses pointers to classes and objects in C++. It explains that class pointers allow for dynamic memory allocation of objects and polymorphism. It covers declaring class pointers, initializing them by pointing to existing objects or allocating memory dynamically, accessing members through pointers using the arrow operator, and pointers to class arrays. Pointers enable more flexible object handling in C++.
Polymorphism refers to an object's ability to take on multiple forms. In object-oriented programming, polymorphism occurs when an entity such as a variable, function, or object can have more than one form. There are two main types of polymorphism: compile-time polymorphism (such as function and operator overloading) and runtime polymorphism (using virtual functions). Polymorphism allows programmers to work with general classes and let the runtime system handle the specific types, providing flexibility.
The document discusses Java's primitive data types including their ranges and literal constants. It covers char, boolean, byte, short, int, long, float, and double data types. It also discusses variables, symbolic constants, and arithmetic operators.
Generics in Java allows the creation of generic classes and methods that can work with different data types. A generic class uses type parameters that appear within angle brackets, allowing the class to work uniformly with different types. Generic methods also use type parameters to specify the type of data upon which the method operates. Bounded type parameters allow restricting the types that can be passed to a type parameter.
The document discusses various window controls in C# .NET including message boxes, forms, buttons, labels, text boxes, check boxes, radio buttons, date/time pickers, progress bars, and dialog boxes. It provides details on how to use each control, its purpose, and relevant properties.
The document provides an introduction to HTML, covering main HTML elements like headings, paragraphs, lists, links, images and tables. It discusses block-level and text-level elements, and how to create hyperlinks and embed images. Examples are given for different HTML tags and elements like headings, paragraphs, links, images, tables and frames. It also covers HTML form controls like text boxes, passwords, checkboxes, radio buttons, dropdowns and buttons.
This document provides an overview of Java generics through examples. It begins with simple examples demonstrating how generics can be used to define container classes (BoxPrinter) and pair classes (Pair). It discusses benefits like type safety and avoiding duplication. Further examples show generics with classes, methods, and limitations like erasure. Wildcard types are introduced as a way to overcome some limitations. Key points covered include generic methods, wildcards, raw types and warnings, limitations of wildcards, and issues with readability of generic code.
HTML forms allow users to enter data into a website. There are various form elements like text fields, textareas, dropdowns, radio buttons, checkboxes, and file uploads that collect different types of user input. The <form> tag is used to create a form, which includes form elements and a submit button. Forms submit data to a backend application using GET or POST methods.
Dom date and objects and event handlingsmitha273566
油
The document discusses the JavaScript Document Object Model (DOM) and regular expressions. It defines the DOM as a programming interface for HTML and XML documents that defines the logical structure and allows manipulation. It describes how the DOM represents an HTML document as a tree of nodes that can be accessed and modified with JavaScript. It provides examples of how to select elements, modify attributes and content, add and remove nodes, and handle events. Regular expressions are also mentioned as a topic.
In JavaScript, almost "everything" is an object.
-Booleans can be objects (if defined with the new keyword)
-Numbers can be objects (if defined with the new keyword)
-Strings can be objects (if defined with the new keyword)
-Dates are always objects
-Maths are always objects
-Regular expressions are always objects
-Arrays are always objects
-Functions are always objects
-Objects are always objects
Constructors in Java are special methods used to initialize objects. There are two types of constructors: no-argument constructors which have no parameters and are used to create default objects, and parameterized constructors which have parameters to provide initial values to objects. Constructors must follow certain rules - they must have the same name as the class, cannot have a return type, and can use any access modifier. The key difference between constructors and methods is that constructors initialize an object's state while methods expose its behavior, and constructors do not have a return type unlike methods.
This document provides an overview of JavaScript arrays, including:
- Declaring and initializing different types of arrays such as associative arrays and indexed arrays
- Common array methods like push(), pop(), splice(), and slice()
- Array attributes including length, indexOf, and typeOf
- Techniques for adding, removing, and modifying array elements
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYAMaulik Borsaniya
油
Classes and Object-oriented Programming:
Classes: Creating a Class, The Self Variable, Constructor, Types of Variables, Namespaces, Types of Methods (Instance Methods, Class Methods, Static Methods), Passing Members of One Class to Another Class, Inner Classes
Inheritance and Polymorphism: Constructors in Inheritance, Overriding Super Class Constructors and Methods, The super() Method, Types of Inheritance, Single Inheritance, Multiple Inheritance, Method Resolution Order (MRO), Polymorphism, Duck Typing Philosophy of Python, Operator Overloading, Method Overloading, Method Overriding
Abstract Classes and Interfaces: Abstract Method and Abstract Class, Interfaces in Python, Abstract Classes vs. Interfaces,
https://www.learntek.org/blog/serialization-in-java/
Learntek is global online training provider on Big Data Analytics, Hadoop, Machine Learning, Deep Learning, IOT, AI, Cloud Technology, DEVOPS, Digital Marketing and other IT and Management courses.
This document introduces object-oriented programming concepts including classes, inheritance, encapsulation, and polymorphism. It discusses how OOP allows for more organized and flexible code through the use of classes, objects, and methods. Key aspects of classes like constructors, destructors, and access modifiers are explained. Other concepts covered include static vs non-static classes, method overloading, enumerations, structures, abstract classes, interfaces, and abstract methods. The document aims to provide an overview of fundamental OOP principles.
Java abstract class & abstract methods,Abstract class in java
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
The document provides an overview of object-oriented programming concepts in .NET such as classes, objects, methods, constructors, destructors, inheritance, polymorphism, interfaces, access modifiers, and static members. It defines each concept and provides examples to illustrate how they are implemented in C#.
1. Inheritance is a mechanism where a new class is derived from an existing class, known as the base or parent class. The derived class inherits properties and methods from the parent class.
2. There are 5 types of inheritance: single, multilevel, multiple, hierarchical, and hybrid. Multiple inheritance allows a class to inherit from more than one parent class.
3. Overriding allows a subclass to replace or extend a method defined in the parent class, while still calling the parent method using the super() function or parent class name. This allows the subclass to provide a specific implementation of a method.
This document provides an overview of PHP arrays, including indexed arrays, associative arrays, and multidimensional arrays. It discusses how to create, access, loop through, and sort arrays in PHP. It also covers PHP global variables like $_SERVER, $_REQUEST, $_POST, $_GET, and $_FILES. The document concludes with an example of exception handling in PHP.
Inheritance allows a class to inherit properties and methods from another class. A subclass inherits attributes and behavior from a base class without modifying the base class. There is single inheritance, where a subclass inherits from only one superclass, and multiple inheritance, where a subclass can inherit from more than one superclass. When an object is created, it allocates memory for all inherited instance variables from its parent classes.
Polymorphism refers to an object's ability to take on multiple forms. In object-oriented programming, polymorphism occurs when an entity such as a variable, function, or object can have more than one form. There are two main types of polymorphism: compile-time polymorphism (such as function and operator overloading) and runtime polymorphism (using virtual functions). Polymorphism allows programmers to work with general classes and let the runtime system handle the specific types, providing flexibility.
The document discusses Java's primitive data types including their ranges and literal constants. It covers char, boolean, byte, short, int, long, float, and double data types. It also discusses variables, symbolic constants, and arithmetic operators.
Generics in Java allows the creation of generic classes and methods that can work with different data types. A generic class uses type parameters that appear within angle brackets, allowing the class to work uniformly with different types. Generic methods also use type parameters to specify the type of data upon which the method operates. Bounded type parameters allow restricting the types that can be passed to a type parameter.
The document discusses various window controls in C# .NET including message boxes, forms, buttons, labels, text boxes, check boxes, radio buttons, date/time pickers, progress bars, and dialog boxes. It provides details on how to use each control, its purpose, and relevant properties.
The document provides an introduction to HTML, covering main HTML elements like headings, paragraphs, lists, links, images and tables. It discusses block-level and text-level elements, and how to create hyperlinks and embed images. Examples are given for different HTML tags and elements like headings, paragraphs, links, images, tables and frames. It also covers HTML form controls like text boxes, passwords, checkboxes, radio buttons, dropdowns and buttons.
This document provides an overview of Java generics through examples. It begins with simple examples demonstrating how generics can be used to define container classes (BoxPrinter) and pair classes (Pair). It discusses benefits like type safety and avoiding duplication. Further examples show generics with classes, methods, and limitations like erasure. Wildcard types are introduced as a way to overcome some limitations. Key points covered include generic methods, wildcards, raw types and warnings, limitations of wildcards, and issues with readability of generic code.
HTML forms allow users to enter data into a website. There are various form elements like text fields, textareas, dropdowns, radio buttons, checkboxes, and file uploads that collect different types of user input. The <form> tag is used to create a form, which includes form elements and a submit button. Forms submit data to a backend application using GET or POST methods.
Dom date and objects and event handlingsmitha273566
油
The document discusses the JavaScript Document Object Model (DOM) and regular expressions. It defines the DOM as a programming interface for HTML and XML documents that defines the logical structure and allows manipulation. It describes how the DOM represents an HTML document as a tree of nodes that can be accessed and modified with JavaScript. It provides examples of how to select elements, modify attributes and content, add and remove nodes, and handle events. Regular expressions are also mentioned as a topic.
In JavaScript, almost "everything" is an object.
-Booleans can be objects (if defined with the new keyword)
-Numbers can be objects (if defined with the new keyword)
-Strings can be objects (if defined with the new keyword)
-Dates are always objects
-Maths are always objects
-Regular expressions are always objects
-Arrays are always objects
-Functions are always objects
-Objects are always objects
Constructors in Java are special methods used to initialize objects. There are two types of constructors: no-argument constructors which have no parameters and are used to create default objects, and parameterized constructors which have parameters to provide initial values to objects. Constructors must follow certain rules - they must have the same name as the class, cannot have a return type, and can use any access modifier. The key difference between constructors and methods is that constructors initialize an object's state while methods expose its behavior, and constructors do not have a return type unlike methods.
This document provides an overview of JavaScript arrays, including:
- Declaring and initializing different types of arrays such as associative arrays and indexed arrays
- Common array methods like push(), pop(), splice(), and slice()
- Array attributes including length, indexOf, and typeOf
- Techniques for adding, removing, and modifying array elements
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYAMaulik Borsaniya
油
Classes and Object-oriented Programming:
Classes: Creating a Class, The Self Variable, Constructor, Types of Variables, Namespaces, Types of Methods (Instance Methods, Class Methods, Static Methods), Passing Members of One Class to Another Class, Inner Classes
Inheritance and Polymorphism: Constructors in Inheritance, Overriding Super Class Constructors and Methods, The super() Method, Types of Inheritance, Single Inheritance, Multiple Inheritance, Method Resolution Order (MRO), Polymorphism, Duck Typing Philosophy of Python, Operator Overloading, Method Overloading, Method Overriding
Abstract Classes and Interfaces: Abstract Method and Abstract Class, Interfaces in Python, Abstract Classes vs. Interfaces,
https://www.learntek.org/blog/serialization-in-java/
Learntek is global online training provider on Big Data Analytics, Hadoop, Machine Learning, Deep Learning, IOT, AI, Cloud Technology, DEVOPS, Digital Marketing and other IT and Management courses.
This document introduces object-oriented programming concepts including classes, inheritance, encapsulation, and polymorphism. It discusses how OOP allows for more organized and flexible code through the use of classes, objects, and methods. Key aspects of classes like constructors, destructors, and access modifiers are explained. Other concepts covered include static vs non-static classes, method overloading, enumerations, structures, abstract classes, interfaces, and abstract methods. The document aims to provide an overview of fundamental OOP principles.
Java abstract class & abstract methods,Abstract class in java
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
The document provides an overview of object-oriented programming concepts in .NET such as classes, objects, methods, constructors, destructors, inheritance, polymorphism, interfaces, access modifiers, and static members. It defines each concept and provides examples to illustrate how they are implemented in C#.
1. Inheritance is a mechanism where a new class is derived from an existing class, known as the base or parent class. The derived class inherits properties and methods from the parent class.
2. There are 5 types of inheritance: single, multilevel, multiple, hierarchical, and hybrid. Multiple inheritance allows a class to inherit from more than one parent class.
3. Overriding allows a subclass to replace or extend a method defined in the parent class, while still calling the parent method using the super() function or parent class name. This allows the subclass to provide a specific implementation of a method.
This document provides an overview of PHP arrays, including indexed arrays, associative arrays, and multidimensional arrays. It discusses how to create, access, loop through, and sort arrays in PHP. It also covers PHP global variables like $_SERVER, $_REQUEST, $_POST, $_GET, and $_FILES. The document concludes with an example of exception handling in PHP.
Inheritance allows a class to inherit properties and methods from another class. A subclass inherits attributes and behavior from a base class without modifying the base class. There is single inheritance, where a subclass inherits from only one superclass, and multiple inheritance, where a subclass can inherit from more than one superclass. When an object is created, it allocates memory for all inherited instance variables from its parent classes.
Inheritance allows one class to inherit properties from another class called the base or super class. The new class is called the derived or sub-class. There are different types of inheritance like hierarchical and multi-level inheritance. The visibility of members of the base class depends on whether the inheritance is public, private or protected.
This document provides an overview of inheritance in object-oriented programming. It defines inheritance as a child class automatically inheriting variables and methods from its parent class. Benefits include reusability, where behaviors are defined once in the parent class and shared by all subclasses. The document discusses how to derive a subclass using the extends keyword, what subclasses can do with inherited and new fields and methods, and how constructors are called following the constructor calling chain. It also covers overriding and hiding methods and fields, type casting between subclasses and superclasses, and final classes and methods that cannot be extended or overridden.
Inheritance allows one class to inherit attributes and behaviors from another existing class. This helps with code reuse by extending an existing class without modifying it. A derived class inherits from a base class, and any changes to the base class will also affect the derived classes. Abstract classes define common behaviors for other classes to inherit from but cannot be instantiated themselves, instead forcing subclasses to implement abstract methods.
This document discusses types of inheritance in object-oriented programming including single, multilevel, multiple, hierarchical, and hybrid inheritance. It provides code examples and explanations of:
- Single, multilevel, multiple, hierarchical, and hybrid inheritance structures
- Access specifiers for base and derived classes and their effects
- Calling base class constructors from derived class constructors
- The virtual keyword and dynamic binding in inheritance
The document contains code examples demonstrating inheritance concepts like defining base and derived classes, accessing members of base classes, and calling base class constructors from derived classes. It also provides explanations of multilevel, multiple, and hybrid inheritance with diagrams.
Here, class PQR contains an object of class ABC as its data member. So class PQR contains class ABC through object ob1. This is an example of containership relationship between classes in OOP.
This document discusses inheritance in Java. It defines inheritance as allowing new classes to reuse properties of existing classes. There are different types of inheritance including single, multilevel, and hierarchical. Key concepts covered include defining subclasses using the extends keyword, using the super keyword to call parent constructors and access parent members, overriding methods, abstract classes and methods, and using the final keyword to prevent overriding or inheritance.
jQuery 竪 un framework javascript che permette di semplificare la scrittura di codice javascript, facilitando l'iterazione con gli elementi della pagina (controlli, stili, eventi, animazioni, ...), e permettendo di aumentare la user experience delle applicazioni, riducendone al tempo stesso la complessit di scrittura. Vista la sua diffusione e potenza, 竪 stato anche incluso nei project templete di Visual Studio. In questa sessione vedremo cos'竪 jQuery, e scopriremo le potenzialit e funzionalit che offre, verificando se il motto "write less do more" sia vero o meno.
Django 竪 uno dei framework web pi湛 apprezzati e utilizzati dalla comunit Python (e non solo).
I suoi punti di forza sono rappresentati dal suo utilizzo rapido e intuitivo, l'ottima documentazione e una larga comunit di sviluppatori ed utilizzatori.
A pi湛 di un anno di distanza dal rilascio della versione 0.96 le feature e i miglioramenti introdotti sono stati molti.
La presentazione mostra alcune di queste novit e l'utilizzo avanzato di alcuni componenti del framework.
In questa sessione vedremo come realizzare un Data Access Layer basato su una implementazione del Repository pattern ed in grado di essere interrogabile mediante query LINQ, eventualmente delegate ad O/RM quali Entity Framework e/o NHibernate. Vedremo inoltre come fare utilizzo dei Code Contracts del FX4 per specificare "una tantum" le regole comuni a tutti i repository di un Domain Model.
Test Bank for Systems Analysis and Design 8th Edition: Kendallalawamajina
油
Test Bank for Systems Analysis and Design 8th Edition: Kendall
Test Bank for Systems Analysis and Design 8th Edition: Kendall
Test Bank for Systems Analysis and Design 8th Edition: Kendall
Essentials of Accounting for Governmental and Not for Profit Organizations 13...orakategy
油
Essentials of Accounting for Governmental and Not for Profit Organizations 13th Edition Copley Test Bank
Essentials of Accounting for Governmental and Not for Profit Organizations 13th Edition Copley Test Bank
Essentials of Accounting for Governmental and Not for Profit Organizations 13th Edition Copley Test Bank
Digital Business Networks 1st Edition Dooley Solutions Manualidderkribo
油
Digital Business Networks 1st Edition Dooley Solutions Manual
Digital Business Networks 1st Edition Dooley Solutions Manual
Digital Business Networks 1st Edition Dooley Solutions Manual
Test Bank for Foundations of Financial Markets and Institutions, 4th Edition:...orrahnaf
油
Test Bank for Foundations of Financial Markets and Institutions, 4th Edition: Frank J. Fabozzi
Test Bank for Foundations of Financial Markets and Institutions, 4th Edition: Frank J. Fabozzi
Test Bank for Foundations of Financial Markets and Institutions, 4th Edition: Frank J. Fabozzi
Test Bank for Understanding Abnormal Behavior, 10th Edition : Suedementogge
油
Test Bank for Understanding Abnormal Behavior, 10th Edition : Sue
Test Bank for Understanding Abnormal Behavior, 10th Edition : Sue
Test Bank for Understanding Abnormal Behavior, 10th Edition : Sue
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manningjelieltoinks
油
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning
Essentials of Accounting for Governmental and Not-for-Profit Organizations 12...orakategy
油
Essentials of Accounting for Governmental and Not-for-Profit Organizations 12th Edition Copley Test Bank
Essentials of Accounting for Governmental and Not-for-Profit Organizations 12th Edition Copley Test Bank
Essentials of Accounting for Governmental and Not-for-Profit Organizations 12th Edition Copley Test Bank
New Methods of Literacy Research 1st Edition Peggy Albersuxhcablende
油
New Methods of Literacy Research 1st Edition Peggy Albers
New Methods of Literacy Research 1st Edition Peggy Albers
New Methods of Literacy Research 1st Edition Peggy Albers
(eBook PDF) Auditing: A Practical Approach with Data Analytics by Raymond N. ...osanoarak
油
(eBook PDF) Auditing: A Practical Approach with Data Analytics by Raymond N. Johnson
(eBook PDF) Auditing: A Practical Approach with Data Analytics by Raymond N. Johnson
(eBook PDF) Auditing: A Practical Approach with Data Analytics by Raymond N. Johnson
Test Bank for Marketing Management, 3rd Edition, Greg Marshall, Mark Johnstonpplqadiri
油
Test Bank for Marketing Management, 3rd Edition, Greg Marshall, Mark Johnston
Test Bank for Marketing Management, 3rd Edition, Greg Marshall, Mark Johnston
Test Bank for Marketing Management, 3rd Edition, Greg Marshall, Mark Johnston
Test Bank for Canadian Organizational Behaviour, 10th Edition, Steven McShane...izmarmelum
油
Test Bank for Canadian Organizational Behaviour, 10th Edition, Steven McShane, Kevin Tasa
Test Bank for Canadian Organizational Behaviour, 10th Edition, Steven McShane, Kevin Tasa
Test Bank for Canadian Organizational Behaviour, 10th Edition, Steven McShane, Kevin Tasa
Presentazione della Dichiarazione di Dubai sulle OER alla comunit italiana -...Damiano Orru
油
Osservatorio sullinformation literacy promuove un incontro online organizzato dalla rete Open Education Italia. n occasione della Open Education Week 2025, dal 3 al 7 marzo, la rete Open Education Italia organizza un incontro online dedicato alla presentazione della Dichiarazione di Dubai sulle Risorse Educative Aperte (OER) il 4 marzo 2025. https://www.aib.it/eventi/dichiarazione-dubai-oer-unesco/
Designing Intelligent Construction Projects Michael Frahmewoadetozito
油
Designing Intelligent Construction Projects Michael Frahm
Designing Intelligent Construction Projects Michael Frahm
Designing Intelligent Construction Projects Michael Frahm
Designing Intelligent Construction Projects Michael Frahmewoadetozito
油
programmazione ad oggetti
1. La Programmazione Orientata agli Oggetti (O.O.P.) Object-Oriented Programming
2. Programmazione imperativa algoritmo si basa sul concetto di : Sappiamo che la Insieme di istruzioni che a partire dai dati di input permettono di ottenere dei risultati in output
3. Come si programma : Applicando i principi della programmazione strutturata : metodologia di analisi Top-Down Strutture di controllo sequenza selezione iterazione
4. La Programmazione si fonda invece sul concetto di : orientata agli oggetti in cui ogni componente 竪 caratterizzato da propriet ( attributi ) e azioni ( metodi ) sistema 竪 un insieme di entit interagenti ( oggetti ) sistema
5. Come si programma in O.O.P. ? applicando i principi della programmazione strutturata cio竪 ... metodologia di analisi Top-Down strutture di controllo sequenza selezione iterazione
6. Quindi quello che cambia 竪 solamente del problema... sequenza interazione la visione algoritmo sistema
7. Per cui 竪 necessario individuare : le entit (gli oggetti) presenti allinterno del sistema le modalit di interazione reciproca Non a caso si parla di programmazione orientata agli oggetti
8. Programmi Algoritmi dati + Per la risoluzione di un Problema metodi attributi Oggetti + Per la gestione di un Sistema
9. Problema complesso scomposizione in procedure scomposizione in entit interagenti (oggetti) Sistema complesso ricapitolando... Programmazione imperativa orientata agli oggetti Programmazione
11. Oggetto = istanza di una Classe automobile velocit colore livello carburante posizione marcia avvia accelera gira fermati cambia marcia rifornisci Classe Ford Focus 1.4 Velocit = 108 colore = nero livello carburante = 15,6 posizione marcia = 5 oggetto Fiat Punto 60 Velocit = 65 colore = verde livello carburante = 32,4 posizione marcia = 3 oggetto
12. Diagramma delle Classi caratteristiche specifiche comportamenti generali nome classe attributo1 attributo2 attributo3 attributo4 metodo1 metodo2 metodo3 metodo4 metodo5 metodo6 automobile velocit colore livello carburante posizione marcia avviati accelera sterza spegniti cambia marcia frena
13. Diagramma degli Oggetti cambiano le caratteristiche specifiche a seconda delloggetto istanziato ( i comportamenti non ci sono perch辿 comuni a tutti gli oggetti appartenenti a quella classe ) Ford Focus 1.4 Velocit = 108 colore = nero livello carburante = 15,6 posizione marcia = 5 nome oggetto attributo 1 = val1 attributo 2 = val2 attributo 3 = val3 attributo 4 = val4 Ferrari GA 04 Velocit = 83 colore = rosso livello carburante = 85,1 posizione marcia = 2
14. Classi . Ereditariet e Gerarchia di ereditariet . Tipi di ereditariet . Polimorfismo
15. Ereditariet classe genitrice costruisco nuove classi partendo da quelle gi esistenti automobile a gas velocit colore livello carburante posizione marcia tipo di gas avvia accelera sterza frena cambia marcia accendi luci scambia gas-benz. Nuova Classe automobile velocit colore livello carburante posizione marcia avvia accelera sterza frena cambia marcia accendi luci Classe
16. Gerarchia di ereditariet Mezzi di trasporto Veicoli a motore Mezzi non a motore Auto a gas Barca Auto Moto Cavallo Bici
17. Gerarchia di ereditariet Mezzi di trasporto Veicoli a motore Auto a gas Barca Auto Moto Classe Sopraclasse (o Superclasse) Sottoclasse Classe Sopraclasse (o Superclasse) Sottoclasse Classe Sopraclasse (o Superclasse)
18. Tipi di ereditariet Eredit singola Eredit multipla Mezzi non a motore Cavallo Bici Animali Mezzi non a motore Cavallo
19. Esempio di ereditariet Mezzi di trasporto velocit numero persone senza patente Veicoli a motore consumo accendi spegni accelera frena Moto cupolino numero ruote piega accelera impenna
20. Ereditariet Classe Sottoclasse La Sottoclasse si differenzia: per Estensione quando la sottoclasse aggiunge nuovi attributi e metodi 1 . per Ridefinizione quando la sottoclasse ridefinisce i metodi riscrivendone il codice ereditato ( overriding del metodo ) 2 .
21. Polimorfismo . 1属 Indica la possibilit per i metodi di assumere forme diverse (cio竪 implementazioni diverse) allinterno della gerarchia delle classi Veicoli a motore Auto Moto accelera accelera accelera implementazione
22. Polimorfismo . 2属 Classe Auto Frena (mano, 3) Frena ( ) Frena (motore) ( overloading dei metodi ) Indica la possibilit per i metodi di assumere forme diverse (cio竪 implementazioni diverse) allinterno della stessa classe parametri = nome
23. Oggetti . Attributi e Metodi . Incapsulamento . Struttura degli oggetti . Interazione tra oggetti . Linterfaccia verso lesterno
24. metodi attributi Oggetti + attributo 1 attributo2 attributo3 attributo4 metodo 1 metodo2 metodo3 metodo4 metodo5 metodo6 Costituiscono la memoria delloggetto e consentono di tenere traccia dello stato delloggetto Sono le operazioni che un oggetto 竪 in grado di compiere ( comportamenti ) Attraverso i metodi un oggetto pu嘆 accedere alla sua memoria e modificare il suo stato
25. Oggetti attributi Descrivono le propriet statiche delloggetto Nella programmazione gli attributi vengono realizzati attraverso luso delle variabili utilizzate dalloggetto per memorizzare i dati metodi attributi +
26. metodi attributi Oggetti + metodi Descrivono le propriet dinamiche delloggetto Nella programmazione i metodi vengono realizzati attraverso la scrittura di codice ( procedure e funzioni ) che implementano le operazioni delloggetto
27. Incapsulamento Viene visto come una scatola nera ( o blackbox ) permettendo cos狸 il mascheramento dellinformazione ( information hiding ) La propriet delloggetto di incorporare al suo interno attributi e metodi viene detta incapsulamento metodi attributi metodi attributi Sezione Pubblica Sezione Privata Loggetto 竪 quindi un contenitore sia di strutture dati e sia di procedure che li utilizzano
28. Sezione Pubblica attributi e metodi che si vogliono rendere visibili allesterno ( e quindi utilizzabili dagli altri oggetti ) Struttura degli oggetti Sezione Privata attributi e metodi che non sono accessibili ad altri oggetti ( e quindi si rendono invisibili allesterno ) pubblica privata
29. Linterfaccia verso lesterno Un oggetto pu嘆 essere utilizzato inviando ad esso dei messaggi Ambiente esterno Linterfaccia non consente di vedere come sono implementati i metodi, ma ne permette il loro utilizzo e laccesso agli attributi pubblici Linsieme dei messaggi rappresenta linterfaccia di quelloggetto Sezione Pubblica avvia( ) accelera( ) sterza( ) frena( ) liv.carburante velocit Sezione Privata ?
30. Interazione fra gli oggetti Un programma ad oggetti 竪 caratterizzato dalla presenza di tanti oggetti che interagiscono fra loro attraverso il meccanismo dello scambio di messaggi Metodi: accelera( ) sterza( ) frena( ) Messaggi: FerrariGA2004 .accelera( ) FerrariGA2004 .frena( ) Ferrari GA 04 Velocit = 83 colore = rosso liv.carburante = 85,1 posizione marcia = 2 Schumacher Data Nascita = 3/1/69 nazione = germania peso = 74 altezza = 174
31. metodi Quando un oggetto invoca un metodo di un altro oggetto ? Interazione fra gli oggetti quando vuole avere uninformazione sul secondo oggetto quando vuole modificare lo stato del secondo oggetto ( in sostanza conoscere o modificare il valore dei suoi attributi )
32. Es. di scambio di messaggi Metodo : accelera( ) FerrariGA04 . accelera( ) Serbatoio . diminuisci( ) Attributi : velocit = 92 giri motore= 9300 Metodo : diminuisci( ) FerrariGA04 . liv.carburante = 85,1 Attributo : quantit = 85,1 Attributo : liv.carburante = 85,1 Ferrari GA 04 Velocit = 83 colore = rosso liv.carburante = 85,3 posizione marcia = 2 giri motore = 8700 Schumacher Data Nascita = 3/1/69 nazione = germania peso = 74 altezza = 174 Serbatoio quantit = 85,3 tipo benz. = superF1 riserva = 15 peso = 77,3 A B C A B C
33. Nuova Metodologia Per costruire un programma orientato agli oggetti occorre: . Stabilire come gli oggetti interagiscono fra loro . . Definire le classi , indicando gli attributi e i metodi . Identificare gli oggetti che caratterizzano il modello del problema
35. Linguaggi Puri ogni cosa 竪 un oggetto ( ...anche un numero intero 竪 definito come oggetto ) . Smalltalk . Eiffel Linguaggi ibridi alcuni tipi di dati non sono oggetti ( maggiore libert a scapito di una maggiore chiarezza ) . C++ . Java . Visual Basic . Delphi
36. # include <iostream.h> class Base { friend void funzione {Base&}; public : int pubblico; void Pubblico() {cout <<Pubblico: <<pubblico<<end1;}; private : int privato; void Privato() {cout <<Pubblico: <<pubblico<<end1;}; protected : int protetto; void Protetto() {cout <<Protetto: <<protetto<<end1;}; }; void funzione{Base &istanza} { istanza.pubblico =1; istanza.privato =2; istanza.protetto=3; istanza.Pubblico(); istanza.Privato(); istanza.Protetto(); } void main() { Base istanzabase; istanzabase.pubblico =10; funzione(istanzabase); } C++
37. import java.applet.*; import java.awt.*; public class semplice extends Applet { private TextArea ta; private Label l; public void init() { ta = new TextArea(10,8); l = new Label(numeri casuali, Label.CENTER); l.setBackground(Color.Yellow); setLayout(new BorderLayout()); add(l, center); add(ta east); generaNumeri(); } Public void generaNumeri() { int casuale; for ( int i=1; i<=10; i++) { casuale = (int (Math.random()*1000); ta.append(-> +casuale+\n); } } } Java
38. Private Sub Command1_Click() N = Val(InputBox(Numero di cui vuoi la radice quadrata :,Radice Quadrata)) Msg = La radice quadrata di & N SqrN = RadiceQ(N) Select Case SqrN Case 0 Msg = Msg & 竪 zero. Case 1 Msg = Msg & 竪 un numero immaginario. Case Else Msg = Msg & 竪 & SqrN End Select MsgBox Msg End Sub Visual Basic
39. unit somma; Interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class (TForm) Button1 : TButton; Edit1 : TEdit; Edit2 : TEdit; Edit3 : TEdit; Button2 : TButton; procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); begin Close; end; procedure TForm1.Button2Click(Sender: TObject); begin Edit3.text := IntToStr(StrToInt(Edit1.text) + StrToInt(Edit2.text)); end; end. Delphi