class

How to add / remove a CSS class to/from an element using jquery

In jquery it is very easy touse DOM and do nice effects.Most common is to add and remove css classes from any of page element.We may need this if we want to make few fields required if particular condition is choosen.

jQuery provides the .addClass() and .removeClass() methods to implement this.

 

Differences between methods and constructors or constructor vs function or method

Differences between methods and constructors.

 

Constructors

A constructor is a method that is run when an object is instantiated. Constructors are useful for initializing variables. The constructor is declared with only the name of the class followed by brackets.

When you create a new instance (a new object) of a class using the new keyword, a constructor for that class is called. Constructors are used to initialize the instance variables (fields) of an object. Constructors are similar to methods, but with some important differences.

 

Instantiating an object or creating an Object

Once we know that a class exist we can use new() keyword for creating object of it.

we must create the main program that will instantiate the object. We will call the main program class TestClass. It should look just like how every other java program starts off.

 

public class TestClass
{
   public static void main(String[] args)
   {
   }
} 

Now we will instantiate the object. To do this we declare a reference to the object called stu and set it equal to a newly created object in memory.

 

Creating a class What Is a Class?

We use the class keyword to define a new class.

 

Class of object definition

A class is the code for an object and an object is the instance of a class in memory. When you create an object from a class it is called instantiating the object.

A definition by its official site:-

"A class is a blueprint or prototype from which objects are created. This section defines a class that models the state and behavior of a real-world object. It intentionally focuses on the basics, showing how even a simple class can cleanly model state and behavior."

 

Object-Oriented Programming(OOP)

Object oriented programming or OOP is a way of writing programs using objects where each object has its attributes and set of operations defined by its class. An object is a data structure in memory that has attributes and methods. The attributes of an object are the same as variables and the methods of an object are the same as functions or procedures.

 

What is Object-Oriented Programming?

Object oriented programming or in short OOP is a way of writing programs using objects. An object is a data structure in memory that has attributes and methods. The attributes of an object are the same as variables and the methods of an object are the same as functions or procedures.

 

Creating Classes in VB6

 Creating a class in Visual Basic is very simple: just select the Add Class Module command from the Project menu. A new code editor window appears on an empty listing. Visual Basic automatically add a class module named Class1, so the very first thing you should do is change the Class name in the Project Properties window in a more appropriate name. The first version of our class includes only a few properties. These properties are exposed as Public members of the class module itself.

  * To create a class module 

  1. Start Visual Basic. 
  2. In the New Project dialog box, select Standard EXE, then click OK. 
  3. On the Project menu, click Add Class Module. 
  4. In the Add Class Module dialog box, select Class Module, then click Open. 
  5. In the Properties window, set the Name property for the class module to Student.

Syndicate content