1 Classes and Controls CE-105 Spring 2007 By: Engr. Faisal ur Rehman.

Slides:



Advertisements
Similar presentations
OO Programming in Java Objectives for today: Constructors Method Overriding & Overloading Encapsulation.
Advertisements

OOP Abstraction Classes Class Members: Properties & Methods Instance (object) Encapsulation Interfaces Inheritance Composition Polymorphism Using Inheritance.
12-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
More about classes and objects Classes in Visual Basic.NET.
Creating Object Oriented Programs Object oriented (OO) terminology Class vs. object Instantiate an object in a project Understand Class_Initialize / Terminate.
ASP.NET Programming with C# and SQL Server First Edition
VB Classes ISYS 512. Adding a Class to a Project Project/Add Class –*** MyClass is a VB keyword. Steps: –Adding properties Declare Public variables in.
CSI 101 Elements of Computing Spring 2009 Lecture # 14 – Classes and Objects Wednesday, April 15th, 2009 and Monday, April 20th, 2009.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
Object-Oriented Programming: Inheritance Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Object-Oriented Programming: Inheritance
To define a class in Visual Basic.NET, you can follow this general procedure: 1. Add a class to the project. 2. Provide an appropriate file name for.
Object Oriented Software Development
Microsoft Visual Basic 2005: Reloaded Second Edition
Module 7: Object-Oriented Programming in Visual Basic .NET
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
BIM313 – Advanced Programming Techniques Object-Oriented Programming 1.
Chapter 6 Understanding the Structure of an Application: Procedures, Modules, and Classes.
Why to Create a Procedure
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
8-1 Chapter 8 Using User-Defined Data Types and Object Oriented Programming.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
JavaScript, Fourth Edition
Programming Pillars Introduction to Object- Oriented Programming.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
Chapter 6 Object-Oriented Java Script JavaScript, Third Edition.
Lecture Set 11 Creating and Using Classes Part B – Class Features – Constructors, Methods, Fields, Properties, Shared Data.
Advanced Object- Oriented Programming Programming Right from the Start with Visual Basic.NET 1/e 14.
Working With Objects Tonga Institute of Higher Education.
Chapter Eleven Classes and Objects Programming with Microsoft Visual Basic th Edition.
Applications Development
CSCI 3327 Visual Basic Chapter 3: Classes and Objects UTPA – Fall 2011.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
1 OOP - An Introduction ISQS 6337 John R. Durrett.
Introduction to Object-Oriented Programming Lesson 2.
Presented by Ted Higgins, SQL Server DBA An Introduction to Object – Oriented Programming.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
Chapter 2 11/18/2015 © by Pearson Education, Inc. All Rights Reserved. Lect9 GC 2011.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
COMPUTER SCIENCE & TECHNOLOGY DEGREE PROGRAMME FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UVA WELLASSA ‏ Properties of Object Oriented Programming.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 4th Edition.
CE-105 Spring 2007 By: Engr. Faisal ur Rehman
Introduction to Object-oriented Programming
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Creating Your Own Classes
Section 2.1: Programming paradigms
Object-Oriented Programming Concepts
Object-Oriented Programming: Classes and Objects
Understand the Fundamentals of Classes
Microsoft Visual Basic 2005: Reloaded Second Edition
Section 2.1: Programming paradigms
Object-Oriented Programming: Classes and Objects
Object-Oriented Programming: Inheritance
Object-Oriented Programming: Inheritance
Chapter 11 – Object-Oriented Programming
VISUAL BASIC.
Programming with Microsoft Visual Basic 2008 Fourth Edition
Object-Oriented Programming: Inheritance
Object-Oriented Programming: Classes and Objects
Tonga Institute of Higher Education
Object-Oriented Programming: Inheritance and Polymorphism
C++ Programming ㅎㅎ String OOP Class Constructor & Destructor.
Object-Oriented Programming: Inheritance
CIS16 Application Development and Programming using Visual Basic.net
CIS 199 Final Review.
Java Programming with BlueJ Objectives
Object-Oriented Programming: Inheritance
Presentation transcript:

1 Classes and Controls CE-105 Spring 2007 By: Engr. Faisal ur Rehman

2 Class Class is a template, from which objects can be instantiated Class  Object Just like: Blue print  Building Stencil  Shapes and letters Cookie cutter  Cookies It is used in Object Oriented Programming

3 Class OOP is a programming technique in which code block is considered as objects of real world

4 Benefits of Class OOP enables: 1. Managing big applications 2. Modifying the code with ease 3. Code is organized properly 4. Updating of the applications 5. Encapsulation: Encapsulation is the ability to contain and control access to a group of associated items. Only methods and properties of a class is available for other programmers to use. It is just like a remote control or Black Box programming 6. Create more flexible applications

5 Components of Class Components are: Fields: Variables used by the class Property: Attributes of an object Methods: Action by the object Events: Response to some action like click

6 Property Code Property code is created easily with snippet Following is read-write property: Private newPropertyValue As Integer Public Property NewProperty() As Integer Get Return newPropertyValue End Get Set(ByVal value As Integer) newPropertyValue = value End Set End Property

7 Method Code Method is a Sub or Function in a class. Following code will add method to a function class Public Function FullName() As String If middleNameValue <> "" Then FullName = firstNameValue & " " & middleNameValue & " " _ & lastNameValue Else FullName = firstNameValue & " " & lastNameValue End If End Function

8 Terms Of Class Constructors: Special methods that execute each time a new instance of a class (an object) is created Public sub new ‘set default values to fields end sub

9 Terms Of Class Shared methods: Shared method does not need initialize of class. Instance Method: Needs initialize of a class e.g., math.sin is a shared method as we use it directly without instantiate of math class Form1.Show is Instance method as it need instantiate of form class

10 Terms Of Class Inheritance Class will derive its attributes and functionality from base class and specialize the base class by adding new properties and methods and override properties and methods The Inherits statement is used to declare a new class, called a derived class, based on an existing class, known as a base class. Classes that serve as a basis for new classes are called base classes. Classes derived from base classes are called derived classes. Use protected keyword for fields to make available to derived class

11 Class Practical In MSDN: “Modeling a Real World Object”

12 Controls Controls are objects with visual interface with input / output capability We can make a customized control based upon set of existing controls Further Reading: In MSDN: “Developing Custom Windows Forms Controls with the.NET Framework”

13 Q & A Define Class List benefits of class Define the following terms: –Encapsulation –Static / Shared method –Instance method –Constructor –Inheitence

14