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

constructors not allowed a return type

1,059 1GB
Hi,
Expand|Select|Wrap|Line Numbers
  1. //my_mysql.h
  2. #include "stdafx.h"
  3. #include <winsock2.h> 
  4. #include <mysql/mysql.h>
  5. #include "username_password.h"
  6.  
  7. class my_mysql
  8. {
  9. private: 
  10.     username_password user_information;
  11.     MYSQL mySql;
  12. public:
  13.     my_mysql(username_password *user_info);
  14.     ~my_mysql();
  15. }
  16.  
Expand|Select|Wrap|Line Numbers
  1. #include "stdafx.h"
  2. //#include <mysql.h>
  3. #include "my_mysql.h"
  4.  
  5. my_mysql::my_mysql(username_password *user_info)
  6. {
  7.     this->user_information=user_info;
  8. }
  9.  
  10. my_mysql::~my_mysql()
  11. {
  12.  
  13. }
  14.  
Expand|Select|Wrap|Line Numbers
  1. //if requrired
  2. //a portion of username_password.cpp
  3. username_password username_password::operator =(username_password u_p)
  4. {
  5.     //username_password temp;
  6.     this->setPassword(u_p.getPassword());
  7.     this->setPortAddress(u_p.getPortAddress());
  8.     this->setServerAddress(u_p.getServerAddress());
  9.     this->setUserName(u_p.getUserName());
  10.     return *this;
  11. }
  12.  
  13. username_password username_password::operator =(username_password *u_p)
  14. {
  15.     //username_password temp;
  16.     this->setPassword(u_p->getPassword());
  17.     this->setPortAddress(u_p->getPortAddress());
  18.     this->setServerAddress(u_p->getServerAddress());
  19.     this->setUserName(u_p->getUserName());
  20.     return *this;
  21. }
  22.  
  23.  
returned error
Expand|Select|Wrap|Line Numbers
  1. 1>------ Build started: Project: mysql_manager, Configuration: Debug Win32 ------
  2. 1>Compiling...
  3. 1>my_mysql.cpp
  4. 1>c:\users\johny\desktop\softback\vc\mysql_manager\mysql_manager\my_mysql.cpp(6) : error C2533: 'my_mysql::{ctor}' : constructors not allowed a return type
  5. 1>Build log was saved at "file://c:\Users\johny\Desktop\softback\vc\mysql_manager\mysql_manager\Debug\BuildLog.htm"
  6. 1>mysql_manager - 1 error(s), 0 warning(s)
  7. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  8.  
  9.  
There is no compilation error with the other files
Error message flew over my head.
Please let me know what am i missing.

The entire source code is attached with the question

Best Regards,
Johny
Attached Files
File Type: zip mysql_manager2.zip (32.0 KB, 91 views)
Jul 15 '10 #1
1 4679
johny10151981
1,059 1GB
Bug fixed. forgot semicolon at the end of the class declaration in the header file
Jul 15 '10 #2

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

Similar topics

5
by: Murat Tasan | last post by:
so i have a situation that i know cannot be solved directly, and i've already worked around it, but i was hoping to find an explanation as to why this behavior is as it is... i have an abstract...
59
by: Michael C | last post by:
eg void DoIt() { int i = FromString("1"); double d = FromString("1.1"); } int FromString(string SomeValue) {
31
by: CeZaR | last post by:
Hi, How can i specify the return type of a function returning a managed array of chars. If i try to write: "char __gc func()" i get an error! How can i do that? Thanks!
3
by: C++ | last post by:
According to Thinking in C++ "You cannot modify the return type of a virtual function during overriding.but there is a special case in which you can slightly modify the return type. If you¡¯re...
17
by: benben | last post by:
Given a class template Vector<>, I would like to overload operator +. But I have a hard time deciding whether the return type should be Vector<U> or Vector<V>, as in: template <typename U,...
2
by: SharpKnight | last post by:
Hi, I am trying to use Generics to create a general method which accepts a number as a parameter (integer, decimal, ...) and then performs some calculations. Below is a simplified example: ...
8
by: TheReckter | last post by:
I can figure out what is wrong with this piece of code, Supposedly there is an error on line 9 of the following piece of code. If anyone could help me with this strange issue, the help would be...
3
by: priyamurthy | last post by:
Do constructors in cpp has any return type? If so please tell clearly. Do dynamic constructors in cpp has any return type? If so please explain about that
1
by: PengYu.UT | last post by:
Hi, Are there any walkaround to enable functions in the derived class with the same function name but different return type? In the following example, D1 and D2 are B's derived class. I want...
18
by: Carl Forsman | last post by:
there are 2 ways to return a value from a function ==================== 1) passing a reference as parameter - the following will return time void Table::Get(char* FieldName, *SYSTEMTIME time) {...
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:
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
marktang
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,...

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.