Microsoft Visual Basic 2005: Reloaded
|
|
- Marjory Hunt
- 5 years ago
- Views:
Transcription
1 Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 10 Creating Classes and Objects
2 Objectives After studying this chapter, you should be able to: Define a class Instantiate an object from a class that you define Add Property procedures to a class Include data validation in a class Create default and parameterized constructors Microsoft Visual Basic 2005: Reloaded, Second Edition 2
3 Objectives (continued) Include methods in a class Overload the methods in a class Create a derived class using inheritance Microsoft Visual Basic 2005: Reloaded, Second Edition 3
4 Classes and Objects Object-oriented programs are based on objects that are instantiated (created) from classes Properties: attributes that describe the object Methods: behaviors that allow the object to perform tasks A class encapsulates properties and methods VB.Net has many built-in classes You can define your own classes Microsoft Visual Basic 2005: Reloaded, Second Edition 4
5 Defining a Class Class statement: defines a class Use Pascal casing for the class name Define attributes and behaviors of the class within the class Code editor automatically adds the Class statement Microsoft Visual Basic 2005: Reloaded, Second Edition 5
6 Defining a Class (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 6
7 Defining a Class (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 7
8 Defining a Class (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 8
9 Defining a Class (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 9
10 Defining a Class (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 10
11 Example 1 Using a Class that Contains Public Variables Only Microsoft Visual Basic 2005: Reloaded, Second Edition 11
12 Using a Class that Contains Public Variables Only (continued) Any class variable declared with Public keyword can be accessed by any application that contains an instance of the class Use Pascal case for Public variables in a class Microsoft Visual Basic 2005: Reloaded, Second Edition 12
13 Using a Class that Contains Public Variables Only (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 13
14 Using a Class that Contains Public Variables Only (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 14
15 Using a Class that Contains Public Variables Only (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 15
16 Using a Class that Contains Public Variables Only (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 16
17 Using a Class that Contains Public Variables Only (continued) Access an object s attributes using the dot operator: objectvariable.attribute Disadvantages of Public variables in a class: The class cannot control the values assigned to the variables Violates the concept of OOP encapsulation Microsoft Visual Basic 2005: Reloaded, Second Edition 17
18 Example 2 Using a Class that Contains a Private Variable, a Property Procedure, and Two Methods Microsoft Visual Basic 2005: Reloaded, Second Edition 18
19 Using a Class that Contains a Private Variable, a Property Procedure, and Two Methods (continued) Class variables declared with Private keyword: Can only be used by the class Are hidden from the rest of the application Names should start with underscore _ Application can change class variable values only by using the class s methods Microsoft Visual Basic 2005: Reloaded, Second Edition 19
20 Using a Class that Contains a Private Variable, a Property Procedure, and Two Methods (continued) Property procedure: A Public method in the class for manipulating a class variable Exposes a Private class variable as a Property for use by the application Microsoft Visual Basic 2005: Reloaded, Second Edition 20
21 Using a Class that Contains a Private Variable, a Property Procedure, and Two Methods (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 21
22 Using a Class that Contains a Private Variable, a Property Procedure, and Two Methods (continued) Get block: contains code to allow an application to retrieve the contents of the variable exposed as a Property Set block: allows an application to assign a value to the variable exposed as a Property ReadOnly keyword: makes a property readable but not settable (no Set block) WriteOnly keyword: makes a property settable but not readable (no Get block) Microsoft Visual Basic 2005: Reloaded, Second Edition 22
23 Constructors Constructor: A method whose instructions are processed automatically when an object is instantiated from a class Purpose is to initialize the class s Private variables Method name must be New May or may not have parameters Default constructor: a constructor with no parameters Microsoft Visual Basic 2005: Reloaded, Second Edition 23
24 Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 24
25 Methods Other than Constructors Methods in a class can be Sub or Function procedures Use Pascal casing for method names Microsoft Visual Basic 2005: Reloaded, Second Edition 25
26 Methods Other than Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 26
27 Methods Other than Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 27
28 Methods Other than Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 28
29 Methods Other than Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 29
30 Example 3 Using a Class that Contains Two Constructors Microsoft Visual Basic 2005: Reloaded, Second Edition 30
31 Using a Class that Contains Two Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 31
32 Using a Class that Contains Two Constructors (continued) Parameterized constructor: a constructor method that contains parameters Method signature: method name and parameter list Best practices: Parameterized constructor should set the values of the class variables using the class s Property procedures to take advantage of any validation code in the Property procedures Microsoft Visual Basic 2005: Reloaded, Second Edition 32
33 Using a Class that Contains Two Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 33
34 Using a Class that Contains Two Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 34
35 Using a Class that Contains Two Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 35
36 Using a Class that Contains Two Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 36
37 Using a Class that Contains Two Constructors (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 37
38 Example 4 Using a Class that Contains Overloaded Methods Microsoft Visual Basic 2005: Reloaded, Second Edition 38
39 Using a Class that Contains Overloaded Methods (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 39
40 Using a Class that Contains Overloaded Methods (continued) Overloaded methods: two or more methods that have the same name but different parameters Constructors can be overloaded To overload a non-constructor method, use the Overloads keyword in the method declaration Many of VB s built-in methods are overloaded, as shown in the Intellisense feature: Microsoft Visual Basic 2005: Reloaded, Second Edition 40
41 Using a Class that Contains Overloaded Methods (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 41
42 Using a Class that Contains Overloaded Methods (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 42
43 Using a Class that Contains Overloaded Methods (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 43
44 Using a Class that Contains Overloaded Methods (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 44
45 Using a Class that Contains Overloaded Methods (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 45
46 Example 5 Using a Base Class and a Derived Class Inheritance: one class can be created from another class Base class: the original class Derived class: the new class created from the base class Inherits keyword: specifies the base class Microsoft Visual Basic 2005: Reloaded, Second Edition 46
47 Using a Base Class and a Derived Class (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 47
48 Using a Base Class and a Derived Class (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 48
49 Using a Base Class and a Derived Class (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 49
50 Using a Base Class and a Derived Class (continued) Derived class contains all of the attributes and behaviors of the base class Derived class may also contain its own attributes and behaviors Overridable keyword: indicates the base class method can be overridden by the derived class Overrides keyword: indicates that a method in the derived class overrides the method with the same name in the base class Microsoft Visual Basic 2005: Reloaded, Second Edition 50
51 Using a Base Class and a Derived Class (continued) MyBase keyword: refers to the base class MyBase.New: tells the computer to process the code in the base class s constructor Microsoft Visual Basic 2005: Reloaded, Second Edition 51
52 Using a Base Class and a Derived Class (continued) Microsoft Visual Basic 2005: Reloaded, Second Edition 52
53 Programming Tutorial Microsoft Visual Basic 2005: Reloaded, Second Edition 53
54 Programming Example Microsoft Visual Basic 2005: Reloaded, Second Edition 54
55 Summary Objects are instantiated from classes Classes encapsulate their attributes and behaviors Class Public data members and methods are exposed to any application that creates an object from the class; class Private members are not Class Public properties allow an application to manipulate private class data members ReadOnly keyword allows a property to be retrieved but not changed Microsoft Visual Basic 2005: Reloaded, Second Edition 55
56 Summary (continued) WriteOnly allows a property to be changed but not retrieved Property Get block implements retrieving the property value Property Set block implements changing the property value Constructor: a sub procedure named New that is processed when an object is created from the class Default constructor: has no parameters Microsoft Visual Basic 2005: Reloaded, Second Edition 56
57 Summary (continued) Derived class: a new class created from another class (the base class) Overridable keyword: indicates that a method in the base class can be overridden in the derived class Overrides keyword: indicates that a method in the derived class overrides a method of the same name in the base class Inherits clause: creates a derived class MyBase keyword: refers to the base class Microsoft Visual Basic 2005: Reloaded, Second Edition 57
Chapter 12. OOP: Creating Object- Oriented Programs. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
Chapter 12 OOP: Creating Object- Oriented Programs McGraw-Hill Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. Objectives (1 of 2) Use object-oriented terminology correctly. Create
More informationChapter 02 Building Multitier Programs with Classes
Chapter 02 Building Multitier Programs with Classes Student: 1. 5. A method in a derived class overrides a method in the base class with the same name. 2. 11. The Get procedure in a class module is used
More information9/21/2010. Based on Chapter 2 in Advanced Programming Using Visual Basic.NET by Bradley and Millspaugh
Building Multitier Programs with Classes Based on Chapter 2 in Advanced Programming Using Visual Basic.NET by Bradley and Millspaugh The Object-Oriented Oriented (OOP) Development Approach Large production
More informationCIS Intro to Programming in C#
OOP: Creating Classes and Using a Business Tier McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Understand how a three-tier application separates the user interface from the business
More informationChapter 2. Building Multitier Programs with Classes The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill
Chapter 2 Building Multitier Programs with Classes McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Objectives Discuss object-oriented terminology Create your own class and instantiate
More informationAdvanced Programming Using Visual Basic 2008
Building Multitier Programs with Classes Advanced Programming Using Visual Basic 2008 The OOP Development Approach OOP = Object Oriented Programming Large production projects are created by teams Each
More informationMicrosoft Visual Basic 2005: Reloaded
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 1 An Introduction to Visual Basic 2005 Objectives After studying this chapter, you should be able to: Explain the history of programming languages
More informationChapter 5 Object-Oriented Programming
Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares
More informationObject oriented programming. Encapsulation. Polymorphism. Inheritance OOP
OOP Object oriented programming Polymorphism Encapsulation Inheritance OOP Class concepts Classes can contain: Constants Delegates Events Fields Constructors Destructors Properties Methods Nested classes
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract Classes
More informationUnderstanding Inheritance and Interfaces
Chapter 8 Objectives Understanding Inheritance and Interfaces In this chapter, you will: Implement the Boat generalization/specialization class hierarchy Understand abstract and final classes and the MustInherit
More informationCLASSES AND OBJECTS IN JAVA
Lesson 8 CLASSES AND OBJECTS IN JAVA (1) Which of the following defines attributes and methods? (a) Class (b) Object (c) Function (d) Variable (2) Which of the following keyword is used to declare Class
More informationBuilding Multitier Programs with Classes
2-1 2-1 Building Multitier Programs with Classes Chapter 2 This chapter reviews object-oriented programming concepts and techniques for breaking programs into multiple tiers with multiple classes. Objectives
More informationChapter 12. OOP: Creating Object-Oriented Programs The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill
Chapter 12 OOP: Creating Object-Oriented Programs McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Chapter Objectives - 1 Use object-oriented terminology correctly Create a two-tier
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract
More informationOOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.
OOPS Viva Questions 1. What is OOPS? OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
More informationPublic Class ClassName (naming: CPoint)
Lecture 6 Object Orientation Class Implementation Concepts: Encapsulation Inheritance Polymorphism Template/Syntax: Public Class ClassName (naming: CPoint) End Class Elements of the class: Data 1. Internal
More informationIntroduction to OOP. Procedural Programming sequence of statements to solve a problem.
Introduction to OOP C++ - hybrid language improved and extended standard C (procedural language) by adding constructs and syntax for use as an object oriented language. Object-Oriented and Procedural Programming
More informationAP Computer Science Chapter 10 Implementing and Using Classes Study Guide
AP Computer Science Chapter 10 Implementing and Using Classes Study Guide 1. A class that uses a given class X is called a client of X. 2. Private features of a class can be directly accessed only within
More informationPROGRAMMING LANGUAGE 2
31/10/2013 Ebtsam Abd elhakam 1 PROGRAMMING LANGUAGE 2 Java lecture (7) Inheritance 31/10/2013 Ebtsam Abd elhakam 2 Inheritance Inheritance is one of the cornerstones of object-oriented programming. It
More informationInheritance and Polymorphism
Object Oriented Programming Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. Al-Azhar University Website: eaymanelshenawy.wordpress.com Email : eaymanelshenawy@azhar.edu.eg
More informationCh02. True/False Indicate whether the statement is true or false.
Ch02 True/False Indicate whether the statement is true or false. 1. The base class inherits all its properties from the derived class. 2. Inheritance is an is-a relationship. 3. In single inheritance,
More informationCMPT 117: Tutorial 1. Craig Thompson. 12 January 2009
CMPT 117: Tutorial 1 Craig Thompson 12 January 2009 Administrivia Coding habits OOP Header Files Function Overloading Class info Tutorials Review of course material additional examples Q&A Labs Work on
More informationC++ Important Questions with Answers
1. Name the operators that cannot be overloaded. sizeof,.,.*,.->, ::,? 2. What is inheritance? Inheritance is property such that a parent (or super) class passes the characteristics of itself to children
More informationOBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe
OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++
More informationLecture Contents CS313D: ADVANCED PROGRAMMING LANGUAGE. What is Inheritance?
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 5: Inheritance & Polymorphism Lecture Contents 2 What is Inheritance? Super-class & sub class Protected members Creating subclasses
More informationCIS 209 Final Exam. 1. A Public Property procedure creates a property that is visible to any application that contains an instance of the class.
CIS 209 Final Exam Question 1 1. A Property procedure begins with the keywords. Public [ReadOnly WriteOnly] Property Private [ReadOnly WriteOnly] Property Start [ReadOnly WriteOnly] Property Dim [ReadOnly
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 5: Inheritance & Polymorphism Lecture Contents 2 What is Inheritance? Super-class & sub class Protected members Creating subclasses
More informationInheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L
Inheritance Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 9.4 1 Inheritance Inheritance allows a software developer to derive
More information02 Features of C#, Part 1. Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211
02 Features of C#, Part 1 Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211 Module Overview Constructing Complex Types Object Interfaces and Inheritance Generics Constructing
More informationPractice for Chapter 11
Practice for Chapter 11 MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) Object-oriented programming allows you to derive new classes from existing
More informationLecture 10 OOP and VB.Net
Lecture 10 OOP and VB.Net Pillars of OOP Objects and Classes Encapsulation Inheritance Polymorphism Abstraction Classes A class is a template for an object. An object will have attributes and properties.
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 4 : Classes & Objects Lecture Contents What is a class? Class definition: Data Methods Constructors Properties (set/get) objects
More informationCS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University
CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University OOP Three main programming mechanisms that constitute object-oriented programming (OOP) Encapsulation Inheritance
More informationCS608 Lecture Notes. Visual Basic.NET Programming. Object-Oriented Programming Inheritance (Part II) (Part II of II) (Lecture Notes 3B)
CS608 Lecture Notes Visual Basic.NET Programming Object-Oriented Programming Inheritance (Part II) (Part II of II) (Lecture Notes 3B) Prof. Abel Angel Rodriguez CHAPTER 8 INHERITANCE...3 8.2 Inheritance
More informationVisual Basic 2008 The programming part
Visual Basic 2008 The programming part Code Computer applications are built by giving instructions to the computer. In programming, the instructions are called statements, and all of the statements that
More informationFramework Fundamentals
Questions Framework Fundamentals 1. Which of the following are value types? (Choose all that apply.) A. Decimal B. String C. System.Drawing.Point D. Integer 2. Which is the correct declaration for a nullable
More informationHierarchical inheritance: Contains one base class and multiple derived classes of the same base class.
1. What is C#? C# (pronounced "C sharp") is a simple, modern, object oriented, and type safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity
More informationC++ & Object Oriented Programming Concepts The procedural programming is the standard approach used in many traditional computer languages such as BASIC, C, FORTRAN and PASCAL. The procedural programming
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 4 : Classes & Objects Lecture Contents What is a class? Class definition: Data Methods Constructors Properties (set/get) objects
More informationOVERRIDING. 7/11/2015 Budditha Hettige 82
OVERRIDING 7/11/2015 (budditha@yahoo.com) 82 What is Overriding Is a language feature Allows a subclass or child class to provide a specific implementation of a method that is already provided by one of
More informationWhat is Inheritance?
Inheritance 1 Agenda What is and Why Inheritance? How to derive a sub-class? Object class Constructor calling chain super keyword Overriding methods (most important) Hiding methods Hiding fields Type casting
More informationInheritance and Encapsulation. Amit Gupta
Inheritance and Encapsulation Amit Gupta Project 1 How did it go? What did you like about it? What did you not like? What can we do to help? Suggestions Ask questions if you don t understand a concept
More informationData Structures (list, dictionary, tuples, sets, strings)
Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in brackets: l = [1, 2, "a"] (access by index, is mutable sequence) Tuples are enclosed in parentheses: t = (1, 2, "a") (access
More informationCS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes
CS111: PROGRAMMING LANGUAGE II Lecture 1: Introduction to classes Lecture Contents 2 What is a class? Encapsulation Class basics: Data Methods Objects Defining and using a class In Java 3 Java is an object-oriented
More informationINHERITANCE & POLYMORPHISM. INTRODUCTION IB DP Computer science Standard Level ICS3U. INTRODUCTION IB DP Computer science Standard Level ICS3U
C A N A D I A N I N T E R N A T I O N A L S C H O O L O F H O N G K O N G INHERITANCE & POLYMORPHISM P2 LESSON 12 P2 LESSON 12.1 INTRODUCTION inheritance: OOP allows a programmer to define new classes
More informationOOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.
OOPs Concepts 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8. Type Casting Let us discuss them in detail: 1. Data Hiding: Every
More informationIntroduction. In this preliminary chapter, we introduce a couple of topics we ll be using DEVELOPING CLASSES
Introduction In this preliminary chapter, we introduce a couple of topics we ll be using throughout the book. First, we discuss how to use classes and object-oriented programming (OOP) to aid in the development
More informationObject Oriented Programming. C++ 6 th Sem, A Div Ms. Mouna M. Naravani
Object Oriented Programming C++ 6 th Sem, A Div 2018-19 Ms. Mouna M. Naravani Object Oriented Programming (OOP) removes some of the flaws encountered in POP. In OOPs, the primary focus is on data rather
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 6 : Abstraction Lecture Contents 2 Abstract classes Abstract methods Case study: Polymorphic processing Sealed methods & classes
More informationObject-Oriented Programming Concepts
Object-Oriented Programming Concepts Real world objects include things like your car, TV etc. These objects share two characteristics: they all have state and they all have behavior. Software objects are
More informationObject Oriented Programming. Java-Lecture 11 Polymorphism
Object Oriented Programming Java-Lecture 11 Polymorphism Abstract Classes and Methods There will be a situation where you want to develop a design of a class which is common to many classes. Abstract class
More informationPaytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value
Paytm Programming Sample paper: 1) A copy constructor is called a. when an object is returned by value b. when an object is passed by value as an argument c. when compiler generates a temporary object
More informationLecture Contents CS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 4 : Classes & Objects Lecture Contents What is a class? Class definition: Data Methods Constructors Properties (set/get) objects
More informationPOLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE
POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE COURSE NAME: OBJECT ORIENTED PROGRAMMING COURSE CODE: OOP521S NQF LEVEL: 6 DATE: NOVEMBER 2015 DURATION: 2 HOURS
More informationInheritance, and Polymorphism.
Inheritance and Polymorphism by Yukong Zhang Object-oriented programming languages are the most widely used modern programming languages. They model programming based on objects which are very close to
More informationC++ Inheritance and Encapsulation
C++ Inheritance and Encapsulation Private and Protected members Inheritance Type Public Inheritance Private Inheritance Protected Inheritance Special method inheritance 1 Private Members Private members
More informationINHERITANCE: EXTENDING CLASSES
INHERITANCE: EXTENDING CLASSES INTRODUCTION TO CODE REUSE In Object Oriented Programming, code reuse is a central feature. In fact, we can reuse the code written in a class in another class by either of
More informationChapter 14 Abstract Classes and Interfaces
Chapter 14 Abstract Classes and Interfaces 1 What is abstract class? Abstract class is just like other class, but it marks with abstract keyword. In abstract class, methods that we want to be overridden
More informationAnd Even More and More C++ Fundamentals of Computer Science
And Even More and More C++ Fundamentals of Computer Science Outline C++ Classes Special Members Friendship Classes are an expanded version of data structures (structs) Like structs, the hold data members
More informationObject-Oriented Programming (OOP) Fundamental Principles of OOP
Object-Oriented Programming (OOP) O b j e c t O r i e n t e d P r o g r a m m i n g 1 Object-oriented programming is the successor of procedural programming. The problem with procedural programming is
More information1. A Web Form created in Visual Basic can only be displayed in Internet Explorer. True False
True / False Questions 1. A Web Form created in Visual Basic can only be displayed in Internet Explorer. 2. Windows Explorer and Internet Explorer are Web browsers. 3. Developing Web applications requires
More informationMore C++ : Vectors, Classes, Inheritance, Templates
Vectors More C++ : Vectors,, Inheritance, Templates vectors in C++ basically arrays with enhancements indexed similarly contiguous memory some changes defined differently can be resized without explicit
More informationObject-Oriented Programming
Object-Oriented Programming 1. What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object
More informationI101 Introduction to Informatics
I101 Introduction to Informatics By: Dr. Hossein Computer Science and Informatics IU South Bend 1 What do we need to learn in order to write computer programs? Fundamental programming constructs: Variables,
More informationMore C++ : Vectors, Classes, Inheritance, Templates. with content from cplusplus.com, codeguru.com
More C++ : Vectors, Classes, Inheritance, Templates with content from cplusplus.com, codeguru.com 2 Vectors vectors in C++ basically arrays with enhancements indexed similarly contiguous memory some changes
More information(12-1) OOP: Polymorphism in C++ D & D Chapter 12. Instructor - Andrew S. O Fallon CptS 122 (April 3, 2019) Washington State University
(12-1) OOP: Polymorphism in C++ D & D Chapter 12 Instructor - Andrew S. O Fallon CptS 122 (April 3, 2019) Washington State University Key Concepts Polymorphism virtual functions Virtual function tables
More informationQuestions Answer Key Questions Answer Key Questions Answer Key
Benha University Term: 2 nd (2013/2014) Class: 2 nd Year Students Subject: Object Oriented Programming Faculty of Computers & Informatics Date: 26/4/2014 Time: 1 hours Exam: Mid-Term (A) Name:. Status:
More informationMaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING SUB CODE / SUBJECT: CS1203 / Object oriented programming YEAR / SEM: II / III QUESTION BANK UNIT I FUNDAMENTALS PART-A (2 MARKS) 1. What is Object Oriented
More informationZhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson
Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program
More informationLogistics. Final Exam on Friday at 3pm in CHEM 102
Java Review Logistics Final Exam on Friday at 3pm in CHEM 102 What is a class? A class is primarily a description of objects, or instances, of that class A class contains one or more constructors to create
More informationObject Oriented Features. Inheritance. Inheritance. CS257 Computer Science I Kevin Sahr, PhD. Lecture 10: Inheritance
CS257 Computer Science I Kevin Sahr, PhD Lecture 10: Inheritance 1 Object Oriented Features For a programming language to be called object oriented it should support the following features: 1. objects:
More informationPolymorphism. Hsuan-Tien Lin. OOP Class, April 8, Department of CSIE, NTU. H.-T. Lin (NTU CSIE) Polymorphism OOP 04/08/ / 26
Polymorphism Hsuan-Tien Lin Department of CSIE, NTU OOP Class, April 8, 2013 H.-T. Lin (NTU CSIE) Polymorphism OOP 04/08/2013 0 / 26 Polymorphism: The Motto One Thing, Many Shapes... H.-T. Lin (NTU CSIE)
More informationWhat are the characteristics of Object Oriented programming language?
What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 4 (a): Classes & Objects Lecture Contents 2 What is a class? Class definition: Data Methods Constructors objects Static members
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 17 Inheritance Overview Problem: Can we create bigger classes from smaller ones without having to repeat information? Subclasses: a class inherits
More informationI BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++
No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)
More informationOops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including:
Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including: Abstraction Encapsulation Inheritance and Polymorphism Object-Oriented
More informationObject Oriented Programming With Visual Basic.NET
Object Oriented Programming With Visual Basic.NET Jinan Darwiche All rights reserved. This book and its content are protected by copyright law. No part of this book may be used or reproduced in any manner
More informationJava Inheritance. Written by John Bell for CS 342, Spring Based on chapter 6 of Learning Java by Niemeyer & Leuck, and other sources.
Java Inheritance Written by John Bell for CS 342, Spring 2018 Based on chapter 6 of Learning Java by Niemeyer & Leuck, and other sources. Review Which of the following is true? A. Java classes may either
More informationMobile Application Programming. Swift Classes
Mobile Application Programming Swift Classes Swift Top-Level Entities Like C/C++ but unlike Java, Swift allows declarations of functions, variables, and constants at the top-level, outside any class declaration
More informationLecture 7: Classes and Objects CS2301
Lecture 7: Classes and Objects NADA ALZAHRANI CS2301 1 What is OOP? Object-oriented programming (OOP) involves programming using objects. An object represents an entity in the real world that can be distinctly
More informationSTUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes
STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes Java Curriculum for AP Computer Science, Student Lesson A20 1 STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes INTRODUCTION:
More informationGraphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub
Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java
More informationVALLIAMMAI ENGINEERING COLLEGE
VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK B.E. - Electrical and Electronics Engineering IV SEMESTER CS6456 - OBJECT ORIENTED
More informationInheritance -- Introduction
Inheritance -- Introduction Another fundamental object-oriented technique is called inheritance, which, when used correctly, supports reuse and enhances software designs Chapter 8 focuses on: the concept
More informationChapter 12 Object-Oriented Programming. Starting Out with Games & Graphics in C++ Tony Gaddis
Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics in C++ Tony Gaddis Addison Wesley is an imprint of 2010 Pearson Addison-Wesley. All rights reserved. 12.1 Procedural and Object-Oriented
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More information(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days
Course Description This course introduces the Java programming language and how to develop Java applications using Eclipse 3.0. Students learn the syntax of the Java programming language, object-oriented
More information(11-1) OOP: Inheritance in C++ D & D Chapter 11. Instructor - Andrew S. O Fallon CptS 122 (October 29, 2018) Washington State University
(11-1) OOP: Inheritance in C++ D & D Chapter 11 Instructor - Andrew S. O Fallon CptS 122 (October 29, 2018) Washington State University Key Concepts Base and derived classes Protected members Inheritance
More informationThe major elements of the object-oriented model
The major elements of the object-oriented model Abstraction Encapsulation Inheritance Modularity Suggested Reading: Bruce Eckel, Thinking in Java (Fourth Edition) Reusing Classes Hierarchy 2 An abstraction
More informationJAVA MOCK TEST JAVA MOCK TEST II
http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your
More informationDepartment of Computer science and Engineering Sub. Name: Object oriented programming and data structures Sub. Code: EC6301 Sem/Class: III/II-ECE Staff name: M.Kavipriya Two Mark Questions UNIT-1 1. List
More informationCS111: PROGRAMMING LANGUAGE II
CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 4&5: Inheritance Lecture Contents What is Inheritance? Super-class & sub class The object class Using extends keyword @override keyword
More informationPASCAL - OBJECT ORIENTED
PASCAL - OBJECT ORIENTED http://www.tutorialspoint.com/pascal/pascal_object_oriented.htm Copyright tutorialspoint.com We can imagine our universe made of different objects like sun, earth, moon, etc. Similarly,
More information1 Developments in the Field of Control Engineering
... Information for readers... 13 1 Developments in the Field of Control Engineering1... 18 1.1 The early days of programmable logic controllers (PLCs)1.1... 19 1.2 The PLC learns to communicate1.2...
More informationPolymorphism. Zimmer CSCI 330
Polymorphism Polymorphism - is the property of OOP that allows the run-time binding of a function's name to the code that implements the function. (Run-time binding to the starting address of the code.)
More informationFactory Method. Comp435 Object-Oriented Design. Factory Method. Factory Method. Factory Method. Factory Method. Computer Science PSU HBG.
Comp435 Object-Oriented Design Week 11 Computer Science PSU HBG 1 Define an interface for creating an object Let subclasses decide which class to instantiate Defer instantiation to subclasses Avoid the
More informationUka Tarsadia University MCA ( 3rd Semester)/M.Sc.(CA) (1st Semester) Course : / Visual Programming Question Bank
Unit 1 Introduction to.net Platform Q: 1 Answer in short. 1. Which three main components are available in.net framework? 2. List any two new features added in.net framework 4.0 which is not available in
More information