473,387 Members | 1,812 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,387 software developers and data experts.

Error converting between gregorian and julian calendar types

this code: http://pastebin.com/f168570c8
gives the compile error:
test_templates.cpp: In function 'int main(int, char**)':
test_templates.cpp:51: error: expected `(' before 'g'
test_templates.cpp:51: error: expected `)' before ';' token
test_templates.cpp:51: error: invalid const_cast from type 'bar<lab2::Gregorian>' to type 'bar<lab2::Julian>*'

where the Julian and Gregorian are date classes that inherit from Date
How do I "make" the variable j as if it was of <template> type Georgian?
Nov 9 '07 #1
3 2532
r035198x
13,262 8TB
this code: http://pastebin.com/f168570c8
gives the compile error:
test_templates.cpp: In function 'int main(int, char**)':
test_templates.cpp:51: error: expected `(' before 'g'
test_templates.cpp:51: error: expected `)' before ';' token
test_templates.cpp:51: error: invalid const_cast from type 'bar<lab2::Gregorian>' to type 'bar<lab2::Julian>*'

where the Julian and Gregorian are date classes that inherit from Date
How do I "make" the variable j as if it was of <template> type Georgian?
Don't be too lazy to post your code here. It's just a copy paste operation.
Nov 9 '07 #2
sicarie
4,677 Expert Mod 4TB
this code: http://pastebin.com/f168570c8
gives the compile error:
test_templates.cpp: In function 'int main(int, char**)':
test_templates.cpp:51: error: expected `(' before 'g'
test_templates.cpp:51: error: expected `)' before ';' token
test_templates.cpp:51: error: invalid const_cast from type 'bar<lab2::Gregorian>' to type 'bar<lab2::Julian>*'

where the Julian and Gregorian are date classes that inherit from Date
How do I "make" the variable j as if it was of <template> type Georgian?
You sure you want to do that with 'j'? Your error is about 'g'....

(Of course, if you'd posted your code, we could see. Specifically, line 51. PS - I don't follow links posted by people I don't know on an internet board...)
Nov 9 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
j=const_cast< bar<Julian> *>g;
has a syntax error. It shouild be:
Expand|Select|Wrap|Line Numbers
  1. j=const_cast< bar<Julian> *> (g);
  2.  
Now the only problem is that g is an object and you can't use const_cast to change an object into a pointer.

While I'm at it, what's with the cast?? Usually in C++ you cast when a) you need to call a relic C function that has something like a void* argument or b) your C++ design is screwed up. C++ casting is a firefighting tool not intended to be part of your everyday coding style.
Nov 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: jaYPee | last post by:
I have created a stored procedure that contain this field (below) in order to meet certain criteria. But my problem is when I try to run the stored procedure I encounter an error "Error converting...
3
by: sunny076 | last post by:
Hi, I am trying to convert from Julian to Gregorian data in C#. I was exploring teh JulianCalendar and Gregorian calendar classes but still not sure how I can do it. For example, the Julian date...
4
by: Saso Zagoranski | last post by:
Hi! I have created an SqlCommand object and I have set some parameters to it... One of the parameters is of the DateTime type; here is the code: sqlCommand.Parameters.Value =...
1
by: Andrew Baker | last post by:
this seems to be an SQL Server error but I cant work out how it is occuring. Itr is also after 3am and I cant keep working but need to demo by tomorrow. TIA. The code is: Private Sub...
0
by: rajmgopal | last post by:
Hello Everyone I am getting the following error when i try to insert a record into Sql Server 2005 from my VB 2005 application. sqlEx = {"Error converting data type numeric to numeric."} I...
2
by: Curious Trigger | last post by:
Hello, if have an asp.net web page with a detailsview. This detailsview uses a sqldatasource connecting to a sql server 2005 database with a select statement simliar to this one: SELECT...
14
by: pdavis06 | last post by:
I know that there is a thread about this, but I was unable to add to it; I just joined. The problem is that I do not want to change the date format for the entire database output, merely for a header...
2
by: ive | last post by:
Server: Msg 8114, Level 16, State 5 Error converting data type varchar to numeric. Hello... I new in MS SQL. Given: 2 servers, same SQL statements, same input, same tables, same data types,...
5
AAPWM
by: AAPWM | last post by:
Hello My job is to extract data from my companies database with Crystal Reports, export that data to Excel, modify the data, save the data as "Text "tab delimited"", and upload to the database...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.