Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8215043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:39:28+00:00 2026-06-07T11:39:28+00:00

i have classes like this class A : public QDialog { A(QWidget *parent); static

  • 0

i have classes like this

class A : public QDialog
{
A(QWidget *parent);
static map<int,QString> dataa;
};

class B : public QThread
{
public void run();
}

class C : public QDialog
{
public void abc();
}

Defination of classes

void B::run()
{
in this function,i am using __dataa__ as __dataa.insert__which is defined initially in A class as public.
}

void C::abc()
{
in this function also,i am using __dataa__ as __dataa.find__ and dataa.end__ which is defined initially in A class as public.
}

Now please help me how can i use that variable dataa in the other two classes B and C.somewhere i seen we have to declare it as static and use it in the B and C class as A::data but its not working and giving error.

these three classes are initialized as

int main()
{
A window;
B datathread;
datathread.start
//B is Qthread inherited and A,C are QDialog inherited
}

class C is initialized from class A by clicking a pushbutton on it and opening its dialog in a new window.
i guess this time i wont be blamed for not clearly formulating my question.please on gods name help me as i am stuck over this from long time.a big thanks in advance for any kind of help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:39:29+00:00Added an answer on June 7, 2026 at 11:39 am

    undefined reference to A::dataa

    You need to define it in A’s .cpp file. Say:

    std::map<int, QString> A::dataa;
    

    Also to make sure this is accessible elsewhere there are two options:

    • declare this map object in the public section of A class
    • or have a copy of this object returned via a function like @Jeeva suggests.

    Now, to access this variable in other units, you would first include the header file for A class.

    #include "A.h" //or something similar..
    

    And to access it:

    void B::run() //and similar with C::run(..)
    {
        A::dataa //do something with it ..
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that I have classes like this: public class Parent { public int
Supposed I have two classes like this: public class Parent { public string Id
I have a set of classes like this: class A { public: int DoIt()
I have classes structured like this: Public MustInherit Class A ' several properties End
I currently have service classes that look something like this public class UserService :
my code is like this: i have two classes first class: public class Box<E>
I have classes like this one: class SomeObject { public function __construct($param1, $param2) {
let's say I have 2 classes like this: public class Foo { [Required] public
I have three classes like this. class A { public class innerB { //Do
Suppose you have 2 classes like so: public class ClassA { public int X

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.