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 780999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:09:47+00:00 2026-05-14T20:09:47+00:00

Hey, in a tutorial C++ code, I found this particular piece of confusion: PlasmaTutorial1::PlasmaTutorial1(QObject

  • 0

Hey, in a tutorial C++ code, I found this particular piece of confusion:

PlasmaTutorial1::PlasmaTutorial1(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args), // <- Okay, Plasma = namespace, Applet = class
    m_svg(this),                    // <- A member function of class "Applet"?
    m_icon("document")              // <- ditto?
{
    m_svg.setImagePath("widgets/background");
    // this will get us the standard applet background, for free!
    setBackgroundHints(DefaultBackground);
    resize(200, 200);
}

I’m not new to object oriented programming, so class derivation and super-classes are nothing complicated, but this syntax here got me confused.

The header file defines the class like this:

class PlasmaTutorial1 : public Plasma::Applet
{

Similar to above, namespace Plasma and class Applet. But what’s the public doing there?

I fear that I already know the concept but don’t grasp the C++ syntax/way of doing it.

In this question I picked up that these are called “superconstructors”, at least that’s what stuck in my memory, but I don’t get this to the full extend.

If we glance back at the first snippet, we see Constructor::Class(...) : NS::SuperClass(...), all fine ’till here. But what are m_svg(this), m_icon("document") doing there? Is this some kind of method to make these particular functions known to the derivated class?

Is this part of C++ basics or more immediate? While I’m not completly lost in C++, I feel much more at home in C 🙂

Most of the OOP I have done so far was done in D, Ruby or Python. For example in D I would just define class MyClass : MySuperClass, override what I needed to and call the super class’ constructor if I’d need to.


Okay, after reading some of the answers, is this…

PlasmaTutorial1::PlasmaTutorial1(QObject *parent, const QVariantList &args)
    : Plasma::Applet(parent, args), // <- Call the _parent_ constructor
    m_svg(this),         // <- set m_svg  (in the _derived_ class) to "this"
    m_icon("document")   // <- set m_icon (in the _derived_ class) to "document"
{
    ...
}

…assumption correct?


Test’s confirm my assumption so far. Thanks a lot! Picking a winning answer is a hard choice, tho…

  • 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-14T20:09:48+00:00Added an answer on May 14, 2026 at 8:09 pm

    What you are seeing is a initialization list. They are encouraged by the C++ FAQ Lite and speed up member initialization, because your members don’t need to take default values before entering the constructor.

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

Sidebar

Related Questions

Hey guys this is my html code: <div class=nakupy> <li class=icn_kategorie><a href=#>Nákupy</a> <div class=sub_menu>
hey, I am a newbie in symfony. I am following this joobet tutorial on
Hey guys I'm following the rails tutorial found here http://net.tutsplus.com/tutorials/ruby/the-intro-to-rails-screencast-i-wish-i-had/ and I've gotten to
Hey there, Now im working this base on dmitko tutorial on extending django-registration post
//Introduction Hey, Welcome..... This is the tutorial //EndIntro //Help1 Select a Stock To use
Hey im trying to write code for a login system, this is my first
hey guys having this really simple problem but cant seem to figure out have
I typed up a simple Ruby code for a tutorial question, as shown below.
Hey so I installed IR_Black.terminal using the tutorial here: http://blog.toddwerth.com/entries/13 And it's super simple.
Hey All- I'm completely new to Django/python and am going through a tutorial for

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.