Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is abstrac class? why it is use?

Answers were Sorted based on User's Feedback



what is abstrac class? why it is use?..

Answer / ramavtar rajput

abstract classes and methods. It is not allowed to create an
instance of a class that has been defined as abstract. Any
class that contains at least one abstract method must also
be abstract. Methods defined as abstract simply declare the
method's signature they cannot define the implementation.

When inheriting from an abstract class, all methods marked
abstract in the parent's class declaration must be defined
by the child; additionally, these methods must be defined
with the same (or a less restricted) visibility. For
example, if the abstract method is defined as protected, the
function implementation must be defined as either protected
or public, but not private.

Is This Answer Correct ?    3 Yes 0 No

what is abstrac class? why it is use?..

Answer / krisha

Abstract class is useful for hiding data from end user.Data
is only used not visible functionality.

Is This Answer Correct ?    2 Yes 0 No

what is abstrac class? why it is use?..

Answer / madipally naveen kumar

Abstract Class is a class , in which at least one method is
declared as abstract.Abstract method is a method for which
implementation is not provided in that class.This method
can be implemented by the classes which inherited the
Abstract class and we can not instantiate the abstract
class.Abstract classes can be used when we want to
partially leave certain methods for inheriting classes to
implement.

Is This Answer Correct ?    2 Yes 0 No

what is abstrac class? why it is use?..

Answer / rstv

Abstract classes are classes that contain one or more
abstract methods. An abstract method is a method that is
declared, but contains no implementation. Abstract classes
may not be instantiated, and require subclasses to provide
implementations for the abstract methods. Let's look at an
example of an abstract class, and an abstract method.

Suppose we were modeling the behavior of animals, by
creating a class hierachy that started with a base class
called Animal. Animals are capable of doing different
things like flying, digging and walking, but there are some
common operations as well like eating and sleeping. Some
common operations are performed by all animals, but in a
different way as well. When an operation is performed in a
different way, it is a good candidate for an abstract
method (forcing subclasses to provide a custom
implementation). Let's look at a very primitive Animal base
class, which defines an abstract method for making a sound
(such as a dog barking, a cow mooing, or a pig oinking).

public abstract Animal
{
public void eat(Food food)
{
// do something with food....
}

public void sleep(int hours)
{
try
{
// 1000 milliseconds * 60 seconds * 60
minutes * hours
Thread.sleep ( 1000 * 60 * 60 * hours);
}
catch (InterruptedException ie) { /* ignore */ }
}

public abstract void makeNoise();
}
Note that the abstract keyword is used to denote both an
abstract method, and an abstract class. Now, any animal
that wants to be instantiated (like a dog or cow) must
implement the makeNoise method - otherwise it is impossible
to create an instance of that class. Let's look at a Dog
and Cow subclass that extends the Animal class.

public Dog extends Animal
{
public void makeNoise() { System.out.println ("Bark!
Bark!"); }
}

public Cow extends Animal
{
public void makeNoise() { System.out.println ("Moo!
Moo!"); }
}

Is This Answer Correct ?    2 Yes 1 No

what is abstrac class? why it is use?..

Answer / satyajit das

abstract class is one where the class parameters are not
defined properly and it is controlled by interface like:

interface gggg{
function ss();
}

interface lll{
function mmm();
}

class boat implements gggg,lll{
public function ss();
public function mmm();
}
$dd = new boat();

It is used due to non presence of multiple inheritance in
PHP.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More PHP Interview Questions

What is the use of rand() in php?

0 Answers  


i have designed a registration form in html (registration.html) and to insert user details in database i have designed a submit form in php (submit_registration.php) but when i click on submit button in registration.html it opens a dialogue box which asks for open or save php(submit_registration.php) even though i have already installed apache HTTP server and php version 5 on my computer and i am using mysql as backend. plz suggest me what should i do????

3 Answers  


How to get no. of rows using MYSQL function?

0 Answers  


What distinguishes php from something like client side java script?

0 Answers  


what is the dirrence in PHP4 & PHP5 . ?

8 Answers  


What are php parameters?

0 Answers  


how to count how many sundays in month?

6 Answers   Photon, SR, TCS,


how to make website package setup like desktop software setup ... that front end and backend can include in setup like single package...?

0 Answers  


Name and explain five of the PHP error constants?

0 Answers  


How to check a variable is array or not in php?

0 Answers  


How can MYSQL functions be available with PHP?

0 Answers  


Explain different types of errors in PHP (i.e. arguments in errorreporting function)?

8 Answers   Base2 Infotech, DCI, Microsoft, Tata Elxsi,


Categories