answersLogoWhite

0


Best Answer

I believe a declared type is the type used when first declaring a variable.

And the actual type is the type that the variable is actually assigned, which

could be the declared type or any subtype of that type. So given

GeometricObject shape = new Triangle();

GeometricObject is the declared type and Triangle is the actual type. To

demonstrate this more clearly the following statements are all correct.

GeometricObject shape; // shape declared to be a GeometricObject

shape = new Triangle(); // actual type assigned = Triangle

shape = new Square(); // now shape refers to a Square object

This is the basis of polymorphism. It allows you to write methods which have

for parameters more general types but are able to handle subtypes differently.

This makes your code more general and reusable.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between an actual type and declared type variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between variable overheads cost variance andfixed overheads cost variance?

Variable overhead cost variance is that variance which is in variable overheads costs between the standard cost and the actual variable cost WHILE fixed overheads cost variance is variance between standard fixed overhead cost and actual fixed overhead cost.


The difference between variable factory overhead incurred and total standard variable factory overhead based on the actual quantity of the cost driver for applying the overhead is the?

cheatFAIL


The difference between actual and standard cost caused by the difference between the actual quantity and the standard quantity is called the?

The difference between actual quantity and standard quantity is called the material quantity variance.


What is the difference between the jack used in actual prices and in the lab?

There is no difference between the jack used in the actual sense and in the lab.


What is the difference between individual differences variables and manipulated variables?

An individual difference variable are variables that occur naturally and that a researcher cannot assign a participant to. These include gender, age, height, etc. A manipulated variable a researcher can assign a person to such as a placebo group vs the actual medicine.


What the difference between actual value and earned value?

The difference between the Actual Value & Earned Value is the Project Cost Variance


What does an auditor do if there is a material difference between an expected and actual balance?

However, if there is a material difference between the expected and actual balance, the auditor will investigate this difference further. At this point the auditor will develop an explanation for the difference.


Difference between reference variable and instance variable?

An object is the actual storage space in memory in which some collection of data resides.A reference variable is a variable which refers to the memory location of an object.Look at the pseudocode below:Object obj = new Object();Here obj is the reference variable, and the data to which it refers is the object.


What is difference between actual foh and applied foh?

dsfrzjhgfjdfk


What is difference between the actual buyers and potential buyers?

actual buyer is that which is actual buyer and potential buyer is that which is potential buyer..............


What is difference between the amount budgeted and the actual amount is called?

Difference between actual amount and budgeted amount is called "Variance" and variance analysis is done to find out the reasons for variance


Difference between Carnot and ideal cycle?

What is the difference between ideal and actual cycle?