I am sorry to delay writing the summary.
Q1:what is object?
A1:Object must be an concret.For example,girl can refer to a wide range,but this girl named xuying is an concret.Also,we often describe an object in two aspects:characteristic and action.For example,the girl's name,age is her characteristics and studying is her action.
We all know the world comprises numerous objects,and these objects can be divided into many classes according to their similarities.
Q2:What is class?
A2:Class is a template.Its contents are based on the real objects.Class contains objects' attributes and fuctions.Attributes refer to characteristics and fuctions refer to actions.We can add the objects' attributes and fuctions into the class,so when we use class to new an object,it will be convenient to call the object's functions and assign its attributes.
Q3:Can object act as a parameter to be delivered?
A3:Of course it can.The class we define is also a data type,so the class can be the type of parameter and the object can be a parameter.
Here are some codes.
//This is a class of Character.
//name of parameters
private String name;
private int blood;
Q4:Why use private to set all member variables' access right in the class,not public?
A4:For the sake of safety.Private makes member variables can be used only in its own class,other classes can't use them,even in its extend class.For example,you have a name attribute,if public,everyone can change your name,if private,only you can change it,which one do you prefer?
//设置角色的名字属性
public void setName(String n){
name = n;
}
//获得角色的名字属性
public String getName(){
return name;
}
The funcions above are different,one has parameter and the other doesn't.
Next lesson we study the class and object further.
Q5:What's the difference between common method and construction method?
Tips:
Every system has a default construcion method,when we define a new construction method,the default is covered automatically.
Q6:What is method overloading?
A6:First is its conditions:1、method's name must be the same.2、parameter has at least one diffenfent aspect: number、type、sequence.Next is whywe need method overloading?For a easy example,some PC has camera inside while some doesn't.Their parameter is different in the number.
Q7:What's the difference between passing by value and reference?
A7:Basic data tpye follows the rules of passing by value.Let's talk about passing by reference.Student st1 =new Student(); When we new Student(),it return the address,the address is assigned to the variable st1.So st1 points to the new object.
相关推荐
C 程序设计教学课件:Chapter 3 class and object.ppt
C++程序设计教学课件:Chapter 3 class and object.ppt
【解惑】类与对象的初始化问题 - 爪哇人
Using Class and Object Variables Inheritance Using Inheritance Summary 12. Input/Output Files Using file Pickle Pickling and Unpickling Summary 13. Exceptions Errors Try..Except Handling ...
The book then looks at the core technologies behind the Python language, including the exception system for handling errors, the class and object orientation system for creating new classes and ...
After a brief explanation of why modeling is an indispensable part of software development, the authors introduce the individual diagram types of UML (the class and object diagram, the sequence ...
Class and Object, Use Case, Sequence, Collaboration, Statechart, Activity, Component, and Deployment Diagrams Extension Mechanisms The Object Constraint Language (OCL) If you're new to UML, a...
Extension Through Inheritance: Adding New Methods 156 A Point Class and Object Allocation 160 The @class Directive 161 Classes Owning Their Objects 165 Overriding Methods 169 Which Method Is Selected?...
Acknowledgments Introduction Chapter 1: What a Tangled Web We Weave Chapter 2: Basics of Object-Oriented Programming ...Appendix B: Conversion Table: PHP 4 and PHP 5 Glossary Index
1.1类和对象 Class and Object 1 1.2包与命名空间 Package and NameSpace 1 1.3构造方法Constructor 2 1.4变量和值 Variable 2 1.5赋值 2 1.6 AS数据类型 3 1.7数据类型转换 3 1.8实例方法,实例变量和静态方法,静态...
Systems Analysis and Design: An Object-Oriented Approach with UML, 5th Edition by Dennis, Wixom, and Tegarden captures the dynamic aspects of the field by keeping students focused on doing SAD while ...
the full 3D shape and pose of all object instances in the image. Our method produces a compact 3D representation of the scene, which can be readily used for applications like autonomous driving. Many ...
existing superpixel classication framework for semantic scene segmenta- tion and achieve a 24% relative improvement over current state-of-the-art for the object categories that we study.We believe ...
The primary goal of this book is to promote object-oriented design using C# and to illustrate the use of the emerging object-oriented design patterns. Experienced object-oriented programmers find that...
Object-Oriented Analysis and Design for Information Systems illustrates how and why building a class model is not just placing classes into a diagram. You will learn the necessary organizational ...
This text provides an overview of UML 2.0, discussing such topics as classes, class relationships, class and object diagrams, use cases, packages, state machines, and more.
// A C++ Program without class and object! #include using namespace std; const int N=200; void strUpper(char *s); void strLower(char *s); int main(){ char ms[N]; cout; cin.getline(ms,N); ...
Part I provides a foundation for real-time C++ by covering language technologies, including object-oriented methods, template programming and optimization. Next, part II presents detailed ...
中文名: Beginning C# Object-Oriented Programming (第1版, 涵盖.NET 4.0 and C# 4.0) 原名: Beginning C# Object-Oriented Programming, 1st edition 作者: Dan Clark 资源格式: PDF 出版社: Apress书号: 978-...
Object Pascal Handbook This is the book summary Table of Contents: Part I Chapter 1: Coding in Pascal Chapter 2: Variables and Data Types ...Chapter 17: The TObject Class Chapter 18: RunTime Library