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::Greg orian>' to type 'bar<lab2::Juli an>*'
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?
3 2561
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::Greg orian>' to type 'bar<lab2::Juli an>*'
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.
sicarie 4,677
Recognized Expert Moderator Specialist
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::Greg orian>' to type 'bar<lab2::Juli an>*'
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...)
j=const_cast< bar<Julian> *>g;
has a syntax error. It shouild be: -
j=const_cast< bar<Julian> *> (g);
-
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 data type
varchar to float".
CASE Final WHEN 0 THEN '--' ELSE Final END AS FinalGrade
The Final field is a float data type.
Could anyone teach me how to fix this problem?
|
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 is 100033 and I
know that it is 2/2/2000 in Gregorian.
I would appreciate if anyone can help point me out.
|
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 = DateTime.Parse(this.DateTextBox.Text);
sqlCommand.ExecuteNonReader();
I get the error:
|
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 myMethod(ByVal cust As String, ByVal invDate As Date)
Dim paramDate As New OleDb.OleDbParameter, Dim paramCustomer As New
OleDb.OleDbParameter
paramDate.ParameterName = "@InvDate"
paramDate.Value = invDate
|
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 checked for possible overflow exception, but did not encounter any.
I have declared the values that i am trying to insert as DECIMAL data
types in my VB code.
| |
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 warning_threshold, critical_threshold, weight FROM thresholds
UPDATE thresholds SET warning_threshold=@warning_threshold,
critical_threshold=@critical_threshold, weight =@weight
I also added insert and delete statements to this datasource.
|
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 on a report and for a field on that report.
I thought that I could just go into the expression builder and paste one of the codes that were posted in the thread about this conversion-you'll know that did not work.
So, I went to the new...
|
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, same triggers.
Problem: One server works fine while the other returns the error above.
I have no idea of the problem why the other is working.
|
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 once again. Ive done this for close to a year and have never had this error message.
"Error converting data type varchar to numeric"
2255;2801
IMPORT LOG;IMPORT MAPPING INTERFACE;IMPORT MAPPINGS;SQL - CALL IMPORT ROUTINES;_DB ERROR
Can...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |