Showing posts with label Objects. Show all posts
Showing posts with label Objects. Show all posts

ASP.NET - The Page Class

All Web forms are instances of the ASP.NET Page class, which is defined in the System.Web.UI namespace. The Page class inherits theTemplateControl class, which in turn, inherits the Control class. As a result, the Page class provides useful events that can be used in the code.

Page Events
ASP.NET uses an event-driven model of programming. This model of ASP.NET defines a sequence of events that are raised during the lifecycle of a Web page. Following are some of the page events:
  • Init - It is the first event that occurs when the server executes an ASP.NET page. It occurs only once in the entire lifecycle of an ASP.NET page.
  • Load - It is fired after the Init event, when the page is requested for the first time and whenever the page is reloaded. This page is used to initialize the variables and the state of controls that are used in the page.

Classes and Objects....cont(3)

Objects
The declaration of a class does not include objects of that class. It only specifies the type of information the objects of this class type will hold, when created. Objects of a class can be created using the class tag-name as type specifier. The syntax used to declare objects is:
class-name object1, object2, .....objectn;
Ads will appear onthe next page refresh.
For example:
class book;
{
public;
int bookno;
float cost;
LEARN MORE>>

Classes and Objects...cont(2)

Array within a Class
Arrays can be used as data members in a class. an Array can be a private or a public data member of the class. If an array is a private data member of the class, then only the member functions of the class can access it. Otherwise if an array is a public data member of the class, it can be accessed directly using objects of the class type. Consider the following class definition:
class myarray
{
int a[20];
public;
void getval(void);
void display(void);
};
Here, the arrray a is declared as a as a private member of the class myarray. It can be accessed only through the member functions of the class like any other private data member . The member function getval() reads the values of elements of the array a and the member function display() prints the values of elements of the array a. LEARN MORE>>

Classes and Objects....cont(1)

An object is a region of storage with associated semantics. After the declaration int i;
we say that " i is an object of type int ". In C++, "object" usually menas "an instance of a class". Thus, a class defines the behaviour of many objects(instances). For example:
class Myclass
{
int a;
public;
void getval(int);
void display();
};
LEARN MORE>>

Classes and Objects

Introduction
A class is a fundamental building block of the object oriented programming language C++. Bjarne Stroustup, the originator of C++ language, gave the name "C with classes" to this language initially. The class is the most important feature of C++. It implements OOP concepts and ties them together.
A class is a way to bind data (describing an entity) and its associated functions together. In C++, a class makes a data type that is used to create objects of this same type.
The prerequisites for classes and objects are structures and the functions. A structure provides a way to group data elements and a function organizes program actions into a named entity.
Class Specification
A class specification consists of two parts:
1. Class declaration
2. Class method definition
Declaration of a Class
A class is declared using the class keyword. the syntax of a class declaration is similar to that of a structure.
The general form of a class declaration is : LEARN MORE>>