Sponsored Content
Top Forums Programming Restricting member of a class non-inheritable in C++ Post 302866795 by DGPickett on Tuesday 22nd of October 2013 05:28:57 PM
Old 10-22-2013
I recall inheritance is for adding, not subtracting. If you have a first class with the common subset, you can inherit and add as you go. D1 can inherit from D2 and add.

If all access is by methods, the methods can be made to do various things if you want a member to not really exist.
 

10 More Discussions You Might Find Interesting

1. Solaris

restricting access

Hi All, I'm on Solaris 8, I need to provide Read-only access to a user to 2 directories only. Using rsh (restricted shell) as the user's login shell, I can restrict the user's access to a certain directory only, but how can I set in such a way that the user can access only the 2 directories... (4 Replies)
Discussion started by: max_min
4 Replies

2. Programming

Handling a signal with a class member function

Hello, i am using the sigaction function to handle the SIGCHLD signal.Is it possible to use a class member function as the handler function (the sa_handler member of the sigaction structure)? The function's signature is: void (*sa_handler)(int);so i don't think i can use a static member function... (2 Replies)
Discussion started by: Zipi
2 Replies

3. UNIX for Dummies Questions & Answers

car class (not school class)

im just trying to have some fun and kill some time writing a c++ program that has a person type in a car make and model then gives them a year and a price. or something like that. i always have problems getting it goin but once the ball is rolling im usually pretty good. anyone wanna help me out? ... (1 Reply)
Discussion started by: rickym2626
1 Replies

4. Programming

C++ class definition with a member of the same class

Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento) typedef struct elemento { char name; char value; List<struct elemento> ltElementos; ... (7 Replies)
Discussion started by: pogdorica
7 Replies

5. Shell Programming and Scripting

restricting users

how can i make my users to not use particular commands in the network like:wall....... pl z help me regarding this (1 Reply)
Discussion started by: yashwanthguru
1 Replies

6. Programming

Writing C++ class and member functions

I have the following class and thought that when I call the set command to set a member, I always use value. Would that be fine? class ModMisfit { protected: Real dtau; Real mdacc; Real mindist; bool hw; Source** src; public: void ... (7 Replies)
Discussion started by: kristinu
7 Replies

7. Programming

static use for class inside the same class c++

Hi, I believe the next code is wrong: class Egg { Egg e; int i; Egg(int ii=0) : i(ii) {} }; because you would end up with an endless definition (memory allocation) of Egg objects, thus int i. Ok, so God Eckel proposes for a singleton: class Egg { static Egg e; int... (5 Replies)
Discussion started by: xavipoes
5 Replies

8. UNIX for Advanced & Expert Users

Get pointer for existing device class (struct class) in Linux kernel module

Hi all! I am trying to register a device in an existing device class, but I am having trouble getting the pointer to an existing class. I can create a class in a module, get the pointer to it and then use it to register the device with: *cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies

9. Programming

Size of Derived class, upon virtual base class inheritance

I have the two class definition as follows. class A { public: int a; }; class B : virtual public A{ }; The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Discussion started by: techmonk
2 Replies

10. Programming

C++ : Base class member function not accessible from derived class

Hello All, I am a learner in C++. I was testing my inheritance knowledge with following piece of code. #include <iostream> using namespace std; class base { public : void display() { cout << "In base display()" << endl; } void display(int k) {... (2 Replies)
Discussion started by: anand.shah
2 Replies
insert_child()															    insert_child()

Name
  insert_child - Composite class method called when a child is created.

Synopsis
  typedef void (*XtWidgetProc)(Widget);
	 Widget w;

Inputs
  w	    Specifies the widget which has been created and is to be added to its parent's children array.

Description
  The  insert_child() method is registered on the insert_child field of the Composite class part structure.  It is called by XtCreateWidget()
  to insert a newly created child into its parent's children array.

  Note that the argument to the insert_child() method is the child widget, not the composite widget that defines  the  method.	 This  method
  must add the specified child to its parent's children array, and do anything else that the particular class uses to keep track of its chil-
  dren.

  The insert_child() method is not chained.  If a class does not define an insert_child() method, it  should  inherit  the  method  from  its
  superclass  by specifying XtInheritInsertChild in the insert_child field of its Composite class part structure.  This field should never be
  NULL.

Usage
  Most composite widgets inherit this method from their superclass.  Some composite widget classes define their own insert_child() method  so
  that	they  can order their children in some convenient way, create companion widgets for each child, or limit the number or class of their
  children.  These classes commonly "envelop" their superclass's method by providing a procedure  that	does  class-specific  processing  and
  explicitly invokes the superclass method.  This technique allows a kind of non-automatic inheritance, and is shown in the example below.

  Note that the Composite insert_child() and delete_child() methods exploit internal common data structures, so you should inherit or envelop
  both or neither.  If you do not inherit or envelop these methods, then your methods are responsible for adding and removing the child  wid-
  get from the children array.	The "Background" section below explains what the insert_child() method of the Composite class itself does.

Example
  The  following procedure is the insert_child() method of the Xaw Paned widget class.	Note that it first calls the insert_child() method of
  its superclass, and then creates a Grip widget for the new child.  (Unless the child	has  constraint  resource  XtNshowGrip	False.)   See
  delete_child(4) for the corresponding delete_child() method.

     static void InsertChild(w)
     register Widget w;
     {
	Pane pane = PaneInfo(w);

	/* insert the child widget in the composite children list with the */
	/* superclass insert_child routine.				   */
	(*SuperClass->composite_class.insert_child)(w);

	if (!IsPane(w)) return;

	/*     Panes will be added in the order they are created, temporarily */

	if ( pane->show_grip == TRUE ) {
	    CreateGrip(w);
	    if (pane->min == PANED_GRIP_SIZE)
		pane->min = PaneSize(pane->grip, IsVert((PanedWidget) XtParent(w)));
	}
	else {
	    if (pane->min == PANED_GRIP_SIZE)
		pane->min = 1;
	    pane->grip = NULL;
	}

	pane->size = 0;
	pane->paned_adjusted_me = FALSE;

     } /* InsertChild */

  In  this example, SuperClass is a symbolic name for the superclass of the Paned widget class.  Note that this method does not determine the
  superclass as follows:

	 XtSuperclass(XtParent(w))

  The parent of w may be a subclass of Paned, and therefore its superclass pointer will not always  be	the  class  whose  method  should  be
  invoked.

Background
  The insert_child() method of the Composite class itself is commonly inherited by subclasses or explicitly invoked by them.  It performs the
  following:

  o  Calls the XtOrderProc registered on the XtNinsertPosition resource of the composite widget to determine the  position  in	the  children
     array  at	which the child should be inserted.  If there is no procedure specified for this resource, it inserts the child at the end of
     the array.

  o  Inserts the child at the appropriate position in the array, moving other children if necessary.  If there is not enough room to insert a
     new child in the children array (that is, num_children = num_slots), it reallocates the array and updates num_slots.

  o  Increments num_children.

  If  a  composite  widget class does not have an CompositeClassExtension record or if the accepts_objects field of that record is False, the
  Intrinsics will not allow non-widget children of that widget.  Therefore, the insert_child() method of a widget class that does not  accept
  object children is guaranteed never to be passed a non-widget child.

See Also
  XtCreateWidget(1),
  Composite(3), Constraint(3),
  delete_child(4).

Xt - Intrinsics Methods 													    insert_child()
All times are GMT -4. The time now is 03:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy