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

  • SEARCH
  • Home
  • 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 6597195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:10:41+00:00 2026-05-25T18:10:41+00:00

Objects in C++ can be created using the methods listed below(that I am aware

  • 0

Objects in C++ can be created using the methods listed below(that I am aware of):

Person p;

or

Person p("foobar");

or

Person * p = new Person();

Then, why does not the Samsung Bada IDE allow me to do the first two methods? Why do I always have to use pointers? I am ok with using pointers and all, just that I want to know the fundamental reason behind the style.

Sample code from Bada API reference.

// Create a Label
Label *pLabel = new Label();
pLabel->Construct(Rectangle(50, 200, 150, 40), L"Text");
pLabel->SetBackgroundColor(Color::COLOR_BLUE);
AddControl(*pLabel);

I modified and tried using the code below. Although it compiles and the app runs, the label does not show up on the form.

// Create a Label
Label pLabel();
pLabel.Construct(Rectangle(50, 200, 150, 40), L"Text");
pLabel.SetBackgroundColor(Color::COLOR_BLUE);
AddControl(pLabel);

Note : Rectangle class which is used creates an object on the fly without pointer. How is it different from Label then? Its confusing :-/

  • 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-05-25T18:10:42+00:00Added an answer on May 25, 2026 at 6:10 pm

    In this code:

    // Create a Label
    Label pLabel;
    pLabel.Construct(Rectangle(50, 200, 150, 40), L"Text");
    pLabel.SetBackgroundColor(Color::COLOR_BLUE);
    AddControl(pLabel);
    

    the label object is destroyed when it goes out of scope and hence it fails to show up on the form. It is unfortunate that the AddControl method takes a reference as that implies that the above should work. Using:

    Label *pLabel = new Label();
    

    works because the destructor is not called by default when the pLabel variable goes out of scope.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using python 3.1.1. I know that I can create byte objects using the
I am aware that you can generate create scripts to generate database objects, but
I'm trying to create a new System.Threading.Thread object using Jscript, but I can't get
How can I find out how many objects are created of a class in
Can JavaScript classes/objects have constructors? How are they created?
In my design I am using objects that evaluate a data record. The constructor
I have a c# factory object which creates objects through factory methods, using a
My concern in the code below is that the param to constructor is not
How can I create an instance of an object using a class reference, and
In javascript you can easily create objects and Arrays like so: var aObject =

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.