473,373 Members | 1,204 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,373 software developers and data experts.

define a constant in a virtual class

How is it possible to define a constant in a virtual class?

E.g. I wrote the following code

tml = {
sayHello : function()
{
alert('hello');
}
}

now if I want to add a constant into tml virtual class, what I need to
do?

I tried something like

tml = {
const1 : Integer = 0,
sayHello : function()

or

tml = {
const1 : function(){return 0;},
sayHello : function()
in both case, trying to get - inside tml object - the value of
const1 ... it results in a Object value and not the Integer value I
need.
Where am I doing mistakes?

Thanks
Andrea

Jun 8 '07 #1
4 3699
Andrew said the following on 6/8/2007 6:02 PM:
How is it possible to define a constant in a virtual class?
Javascript has no concept of what a "constant" is. What is it that you need?
Where am I doing mistakes?
const1: 0;

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 9 '07 #2
Well what I need is to a have a variable that store a value that can
be matched with another value.

According to my sample above.

tml = {
sayHello : function()
{
alert('hello');
} ,
myvalue = 0,
sayHello2 : function()
{alert (tml.myvalue)}
}

Jun 9 '07 #3
Andrew said the following on 6/9/2007 4:52 AM:
Well what I need is
<snip>

What you "need" is to quote what you are replying to so people know what
it is that you are replying to/about. You might be surprised to know how
many people ignore people who top-post, don't quote, or don't trim. It
is brutal sometimes.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 9 '07 #4
What you "need" is to quote what you are replying

I suppose the overquoting is an activity that let waste people time
and space, especially when people don't run on 48'' screen. Scroll
down the mouse along the screen and cross the eye just because read
the previous reply it's too difficult.

Quoting should be - at my advice - done when multiple reply or more
argument has given not always.
So, I appreciate your suggestion, but I think that an interesting
reply was better that read how to post.

This is an abstract of netiquette ... "When replying to a message,
include enough original material to be understood but no more.
It
is extremely bad form to simply reply to a message by including
all the previous message: edit out all the irrelevant material."

And I think that a summarize in my case wasn't needed.

Bye
Andrea

Jun 9 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Nolan Martin | last post by:
is a static functions address constant? ie.. static void func(); write_to_file(&func); Restart program... static void func(); void (*funcPtr) ();
7
by: Morgan Cheng | last post by:
Hi, In my program module, there are some Constants should be defined to be integer key value of std::map. In the module, methods of a few classes will return std::map containing value indexed by...
4
by: Tony Johansson | last post by:
Hello Experts!! Assume I have a base class called animal. I want this class to be abstract so I make the destructor pure virtual by having this statement. virtual ~Animal() = 0; Destructor...
5
by: Paul E Collins | last post by:
I have a class hierarchy representing data importers, each of which reads lines from a particular type of comma-separated data file and creates corresponding entries in a database. There is an...
2
by: Jason | last post by:
What is the difference between 'const' and 'define()' ? When would I prefer using 'const' over 'define', or vice versa? It seems if i do: const secondsInMinute = 60; define("secondsInMinute",...
10
by: Dennis Jones | last post by:
Hello, I have a hierarchy of classes in which there will be a data element that is common to all descendant classes. This element (a string in this case) is constant, but specific to each...
5
by: alan | last post by:
Hello world, I'm wondering if it's possible to implement some sort of class/object that can perform mapping from class types to strings? I will know the class type at compile time, like so:...
11
by: Sachin Garg | last post by:
I need to build two executables from my code, one having all the code (and thus application features) and other not having it all. How to best manage the code that shouldn't go in one of the...
8
by: Stefano Sabatini | last post by:
Hi all, I'm encountering this while trying to implement a factory singleton method to generate objects. The singleton has a static map which binds a static creation function defined in each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.