class in Ruby

"class is a blueprint of an Object" What's that mean? Object and class,An object is a package which are called at the runtime which cannot modified at run time,So what we defined in class are converted to object and this object are called at runtime execution.
so we can call class as a blue print of an object.In class we actually designing our program for the output what we required.We can include method inside the class so methods need variable declaration for their operations,Programmers can decide these methods and variables should be kept as private for outside the class.All kinds of designing are done inside the class.Lets look at an example how class and object are created at ruby.
To crate a class in ruby, use the key word class and class name should start with capital alphabetic letter and to create a object use the keyword new

In this program Animal is the class and dog is the method inside method there is a message of string type,When we call this class as object and from the object we call the method,It will print "I am Barking". is the object creation and new method is assigned to barking.The new object of animal is created with address like <0x000000111> something like that.So object is created now we can call the method the created object using "" .

No comments:

Post a Comment


selenium javascript alert box

This is a easy task to capture javascript based alertbox , /* * To change this license header, choose License Headers in Project Properti...